Code example for NfcManager

Methods: getDefaultAdapter

0
	@Override 
	protected void onPause() { 
		super.onPause(); 
		 
		NfcManager manager = (NfcManager) getSystemService(NFC_SERVICE);
        manager.getDefaultAdapter().disableForegroundNdefPush(this);
	} 
 
	@Override 
	protected void onResume()  { 
		super.onResume(); 
		 
		NfcManager manager = (NfcManager) getSystemService(NFC_SERVICE);
        NdefRecord rec = new NdefRecord(NdefRecord.TNF_ABSOLUTE_URI, NdefRecord.RTD_URI, new byte[0],share.getBytes());
		manager.getDefaultAdapter().enableForegroundNdefPush(this, new NdefMessage(new NdefRecord[]{rec}));
	} 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE