Search code examples
androidnfcintentfilter

Most specific NFC-Tag-Intent-Filter possible?


I'd like to detect all plain-text NDEF-NFC-Tags that have a certain prefix (e.g. "mytagprefix1234567890". What is the most specific intent-filter I could use for this senario to make sure that my application has the highest priority when reading such a tag? Data-schemes can only be defined for Smart-Poster-URI-Tags, correct?

I'm currently using

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

Solution

  • If you are controlling the tag contents, which it seems like you are, why not use a custom mime type or uri?

    There isn't a more specific way to filter for this as text records are mapped to text/plain mime types, which are pretty general.