Code example for NfcAdapter

Methods: enableForegroundDispatchsetNdefPushMessage

0
     * 
     * If this needs to be changed in the future, change what the message is, or list a different activity in 
     * setNdefPushMessage. 
     */ 
    public void enableNdefExchangeMode() { 
        adapter.setNdefPushMessage(message, activity);
        adapter.enableForegroundDispatch(activity, nfcPendingIntent, ndefExchangeFilters, null);
    } 
 
    /** 
     * Call to disable any sort of exchange between NDEF devices. 
     */ 
    public void disableNdefExchangeMode() { 
//        passing a null value disables foreground NDEF push in the specified activity. 
        adapter.setNdefPushMessage(null, activity);
        adapter.disableForegroundDispatch(activity);
    } 
 
    /** 
     * Gets the message from a text view and turns it into an NDEF Message and returns it as well as setting the message 
Connect your IDE to all the code out there  Get Codota for Java