Take the 2-minute tour ×

I want to be able to send a URL via NFC so that it can be opened by the receiving phone's browser on android phones. Is this a possible action?

share|improve this question
Only if the application ("browser") is configured/registered to do this. If you write your own browser you can support it, dont know about the standard android browser or chrome –  user1281750 Jan 14 '13 at 21:39
Can't you already send links over NFC on default android broswers? –  user1681001 Jan 14 '13 at 21:44
Yes, but I believe that this is the case when the browser is active. In your situation you want a registered application to open when the tag is read. I dont believe that the default browser supports this. I will have a look –  user1281750 Jan 14 '13 at 21:50
add comment

3 Answers

Heck yes.

Put an NDEF formatted record containing the URL of the website onto the tag and you're done.

The Android SDK is FULL of examples.

share|improve this answer
Hi, would it be possible for you provide an example of this? I want to send an arbitrary url from 1 phone, wwwm.google.com for example –  user1681001 Jan 14 '13 at 22:13
add comment

Code blocks are from Android reference:

This is what you want to do, but you cant change the intent filters of the default Android browser.

Reading NDEF data from an NFC tag is handled with the tag dispatch system, which analyzes discovered NFC tags, appropriately categorizes the data, and starts an application that is interested in the categorized data. An application that wants to handle the scanned NFC tag can declare an intent filter and request to handle the data.

These features are supported if apps are active supporting beam functionality:

The Android Beam™ feature allows a device to push an NDEF message onto another device by physically tapping the devices together. This interaction provides an easier way to send data than other wireless technologies like Bluetooth, because with NFC, no manual device discovery or pairing is required. The connection is automatically started when two devices come into range. Android Beam is available through a set of NFC APIs, so any application can transmit information between devices. For example, the Contacts, Browser, and YouTube applications use Android Beam to share contacts, web pages, and videos with other devices.

Do you see the difference between the two?

Hope this helps

share|improve this answer
add comment

After scratching my head for a few hours and browsing numerous posts. I found that all I needed to do was implement the NdefCallbacks and set the uri in the "createNdefMessage" method.

First implement the NdefCallbacks

public class MyActivity implements CreateNdefMessageCallback, OnNdefPushCompleteCallback {

Add the unimplemented methods

public NdefMessage createNdefMessage(NfcEvent event) {  
public void onNdefPushComplete(NfcEvent arg0) {

Create an NFC Adapter at the top of your activity

NfcAdapter mNfcAdapter;

Then setup the NFC Adapter in the onCreate method

mNfcAdapter = NfcAdapter.getDefaultAdapter(this);
if(mNfcAdapter != null) {
    // Register callback to set NDEF message
    mNfcAdapter.setNdefPushMessageCallback(this, this);

    // Register callback to listen for message-sent success
    mNfcAdapter.setOnNdefPushCompleteCallback(this, this);
} else {
    Log.i("LinkDetails", "NFC is not available on this device");

Then put the following in your createNdefMessage method:

return new NdefMessage(new NdefRecord[] {

Tap away, Android will handle the rest.

Thanks to the fine folks at TAPPED for their guide, which got me about 3/4ths of the way to a successful NFC implementation.

share|improve this answer
More examples here: code.google.com/p/ndef-tools-for-android –  ThomasRS Feb 26 '13 at 9:56
Don't forget to add the NFC permission to your application manifest: <uses-permission android:name="android.permission.NFC"/> - developer.android.com/reference/android/… –  Mike Jarema Jun 20 '13 at 14:54
add comment

Your Answer


