Code example for NfcAdapter

Methods: setNdefPushMessageCallback, setOnNdefPushCompleteCallback

0
        if (apiVersion >= 14) {
            // Without this call the app sends messages even though nothing was typed in the chat field. 
            // The content of the message is "play.google.com/store/apps/details?id=de.lmu.mm&featrue=beam". 
            // It opens the play store and searches for the app 
            // By disabling pushing in the beginning we surpress this call: 
            adapter.setNdefPushMessageCallback(null, activity);
            adapter.setOnNdefPushCompleteCallback(null, activity);
        } else { 
            LogHelper.getInstance().e( 
                    TAG,
                    "Cannot setup NdefPushMessageCallback because the api of your device " + apiVersion
                            + " is smaller 14"); 
        } 
    } 
 
    @Override 
    public void setupConnection(Activity activity, ServiceDescription serviceDescription) {
        this.serviceDescription = serviceDescription;
        notifyDaemonConnectionIsSetUp(serviceDescription.getAddressOfServer());
    }