JCDrew90
JCDrew90

Reputation: 59

Restricting NFC tag to only an application (Android)

I am fairly new in Android programming and am planning to work on a coupon system using NFC. I have read about reading and writing NFC tags through Android programming and have learnt about the intent filters.

My question is, is it possible to only program a tag so that it will only run my application, not any others. With that said, is it possible to make it not readable by any other applications? I'm quite blur about the types of tags and hope someone could clarify on this matter.

Upvotes: 2

Views: 2526

Answers (3)

ThomasRS
ThomasRS

Reputation: 8287

I suggest you use

  1. An Android Application record (+Mime record if you want to support older phones)
  2. An Unknown record which only you understand, encrypted using private-public keys.

You might also be interested to see there is such a thing as a Signature record.

Upvotes: 0

NFC guy
NFC guy

Reputation: 10228

When you put an NDEF message on the tag (see Ndef), you can add an Android Application Record at the end of the NdefMessage. This will ensure that only your app will be started. If the app is not installed on the device, the user will be redirected to the Play Store app to install it (if it is available there).

Upvotes: 0

kichik
kichik

Reputation: 34704

You can mark the tag with a specific mime type, or even tag type, and write the intent filter in such a way that your application will get those tags. But other apps can just copy your intent filter and get notified of the tags too.

You can try encrypting the data on the tag so only your app can read that, but even that is far from flawless. Someone can easily decode the key from your APK. You can encrypt your APK too, but seems to be only supported on Jelly Bean and above.

It all depends on how much time and effort you're willing to put into hiding the contents of your tags, in comparison to how much time and effort your target audience will be willing to invest to crack it.

Upvotes: 2

Related Questions