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. 
     */ 
    protected void enableNdefExchangeMode() { 
        adapter.setNdefPushMessage(message, activity);
        adapter.enableForegroundDispatch(activity, nfcPendingIntent, ndefExchangeFilters, null);
    } 
 
    /** 
     * Call to disable any sort of exchange between NDEF devices. 
     */ 
    protected 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 
Stop searching for code, let great code find you!  Add Codota to your java IDE