0
votes

I'm working on an android app that uses NFC to open an activity. So we wrote a NFC tag with specific MIME-Type, like in the API example, so only my app can open the data in it. It was working just fine on Android 2.3.3 to Android 4.0.4.

Now, after I upgraded my Samsung Galaxy Nexus to Android 4.1 Jelly Bean the NFC tag isn't opening my app anymore. The funny thing is that the phone recognizing the mime type of the tag when it shows it in the default android nfc reader.

So the question is... why the app isn't opened by the NFC tag in Android 4.1 Jelly Bean?

The Intent code in my AndroidMenifest.XML:

    <activity 
        android:name=".ActivityToOpenWithNfcTag"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.nfc.action.NDEF_DISCOVERED" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="application/com.android.barcodeScanner" />
        </intent-filter>
    </activity>

If I use the "text/plain" mime type in the tag and the app it works, but I need my unique mime type.

Please help! Thanks.

2

2 Answers

3
votes

I had the same exact problem and I figure out that in Jelly Bean, it converts the mimetype to all lower cases. I see that in your mimetype tag it has an uppercase "S".

So try this instead:

mimeType = "application/com.android.barcodescanner"

Hope this helps :)

0
votes

In JellyBean, NDEF detection and parsing from tags has been improved and become stricter. Probably your NDEF message is somehow invalid. Check for example the payload length value inside the NDEF message and compare that with the total NDEF message length as stored on the tag.