Home » Android » android – Starting a web request when an nfc sticker is detected-Exceptionshub

android – Starting a web request when an nfc sticker is detected-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment

Questions:

Is there an app which calls a definable URL when a NFC sticker is detected? I want to put different stickers on my desk and when I place my phone on one of the stickers a specific URL should be call:

If StickerA is detectd call https://www.myserver.com/?val=a

If StickerB is detectd call https://www.myserver.com/?val=b

If StickerC is detectd call https://www.myserver.com/?val=c

etc.

Is this possible with android without activating the phone and is there a an existing app for that task?

How to&Answers:

Detecting a sticker, and taking an action are two different things. When you detect a sticker, I think you can get the ID of the sticker, then, based on the ID, you would create an Action View Intent passing the URL and that would cause an external browser window to open with the URL you passed.

//pass any url to this function to open a new browser session 
protected void handleExternalDeviceActivity(String url) {
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    startActivity(intent);
}

Answer:

you can write unique URL in every “sticker” or nfc tag by many Android App you can try NFC tools, then when you touch your Android device it will open the URL.

without activiating the Android device you will not be able to communicate with NFC tag*.

*you could with rooted device and you need to write the app by your self.

Answer:

The Android OS itself has the ability to detect NFC and launch a web browser to open a URL on the NFC stickers/Tags (as long has the phone has NFC hardware and it is turned on)

The Sticker/Tag has to have the correctly formatted NDEF data written to it.

You can use https://play.google.com/store/apps/details?id=com.wakdev.wdnfc or other apps to write the correct data to the stickers/tags to store the URL correctly.

You can write your own App to do this as well but it does not require a “rooted device”. But it does require then device to have the hardware and for it to be turned on.