Java tutorial
//package com.java2s; //License from project: Open Source License import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.net.Uri; import android.nfc.NdefMessage; import android.nfc.NdefRecord; import android.nfc.NfcAdapter; import android.os.Build; public class Main { @TargetApi(14) public static boolean setPushMessage(Activity activity, Uri toShare) { NfcAdapter adapter = getAdapter(activity); if (adapter != null) { adapter.setNdefPushMessage(new NdefMessage(new NdefRecord[] { NdefRecord.createUri(toShare), }), activity); return true; } return false; } @TargetApi(14) private static NfcAdapter getAdapter(Context context) { if (Build.VERSION.SDK_INT < 14) return null; return NfcAdapter.getDefaultAdapter(context.getApplicationContext()); } }