Forum Xamarin.Android

I am not able to create an intent filter with an empty scheme

Hello,

i am trying to add an intent filter to my activity with an empty scheme. The filter looks like this:

[Activity(Label = "ClockActivity"), IntentFilter(new[] { "android.nfc.action.NDEF_DISCOVERED" }, Categories = new[] { "android.intent.category.DEFAULT" }, DataScheme = "")]

With this empty scheme i should receive NFC Tags with an url without a scheme. The same example works in Android Studio but i think on xamarin the empty scheme will be ignored.

Do you have any suggestion how to achieve this?

Thank you very much.

Answers

  • CheesebaronCheesebaron DKInsider, University mod

    Your IntentFilter looks wrong.

    Should be something like:

    [IntentFilter(new[]{ NfcAdapter.ActionNdefDiscovered }, 
            Categories = new[] { Intent.CategoryDefault },
            DataScheme = "")]
    
  • I think the both IntentFilter are the same. You have used the string constants and i wrote them directly into the filter.

Sign In or Register to comment.