Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NDEF_DISCOVERED intent contains null fields #17

Open
Ragnt opened this issue Mar 21, 2023 · 2 comments
Open

NDEF_DISCOVERED intent contains null fields #17

Ragnt opened this issue Mar 21, 2023 · 2 comments

Comments

@Ragnt
Copy link

Ragnt commented Mar 21, 2023

Hello,

I am capturing an NDEF_DISCOVERED intent succesfully, however while the intent action contains android.nfc.action.NDEF_DISCOVERED and the extras contains the expected fields, all of the data is null. According to THIS the data associated with my intent should be stored in the extra.NDEF_MESSAGES array, however it returns empty. I believe this is an error on the plugin side, as the data sent back from _eventChannel.receiveBroadcastStream().map<Intent?>() is also missing the data.

AndroidManifest.xml contains the following in the correct activity:

<intent-filter>
    <action android:name="android.nfc.action.NDEF_DISCOVERED" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="application/canvas.nfc"/>
</intent-filter>

The code I am using to debug:

_sub = ri.ReceiveIntent.receivedIntentStream.listen((ri.Intent? intent) {
  if (intent != null) {
    if (intent.action == "android.nfc.action.NDEF_DISCOVERED") {
      print(intent);
    }
  }
}

And the result:

Intent(fromPackageName: null, fromSignatures: null, action: android.nfc.action.NDEF_DISCOVERED, data: null, categories: null, extra: {android.nfc.extra.NDEF_MESSAGES: [null], android.nfc.extra.ID: []})

I was able to confirm the tag has the correct contents via another app. My assumption here was that because the data of my payload (mimeType record) is raw bytes (and not UTF encodeable) the bundleToJson function was breaking, however after writing a string to the payload the issue persists.

@daadu
Copy link
Owner

daadu commented Mar 22, 2023

Hi can you confirm that the field is empty on Android plugin side as well. Need to put Log.e(...) were the intent is converted to Map.

@daadu
Copy link
Owner

daadu commented Jun 22, 2023

@Ragnt There has been a fix for ByteArray conversion published with v0.2.4, try to upgrade and see if this fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants