2

My app is made in Xamarin Forms. I have just compiled my application with the Android 31 SDK, and when the application launches on a smartphone on Android 13, the NFC reading process shows me a window to select the application that can read the nfc tag.On other versions of android I do not have this window that appears.

The permissions included in the manifest :

<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.BIND_NFC_SERVICE" />
<uses-permission android:name="android.permission.NFC_TRANSACTION_EVENT" />

And the code to declare listening :

var intent = new Intent(this, this.GetType()).AddFlags(ActivityFlags.SingleTop);
this.NFCdevice.EnableForegroundDispatch(
this, 
PendingIntent.GetActivity(this, 0, intent, 0), 
new[] { new IntentFilter(NfcAdapter.ActionTechDiscovered) }, 
new[]
    {
        new[] { NFCTechs.Ndef }, new[] { NFCTechs.MifareClassic }, new[] { NFCTechs.MifareUltralight }, 
        new[] { NFCTechs.NdefFormatable }, new[] { NFCTechs.NfcA }
    });

If someone has an idea.

I tried to add the NFC in the requirements of the application :

[assembly: UsesFeature("android.hardware.nfc", Required = true)]

I also added these formats :

NFCTechs.NfcB, NFCTechs.NfcF, NFCTechs.NfcV
Pastaru
  • 21
  • 2

0 Answers0