Code example for NfcAdapter

Methods: setNdefPushMessageCallbacksetOnNdefPushCompleteCallback

        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 "". 
            // 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 { 
                    "Cannot setup NdefPushMessageCallback because the api of your device " + apiVersion
                            + " is smaller 14"); 
    public void setupConnection(Activity activity, ServiceDescription serviceDescription) {
        this.serviceDescription = serviceDescription;
Experience pair programming with AI  Get Codota for Java