I am developing a mobile application for Android for reading and writing data on NFC. While working with the chip M24SR04 from ST, then everything worked. After the transition to the chip M24LR64ER (also from ST) - ceased.

The application can not pass through the test:

if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action) || NfcAdapter.ACTION_TECH_DISCOVERED.equals(action) || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) 

The logs of Android Studio write the following:

 01-23 12:14:49.350 273-803/? D/ALSADevice: route: devices 0x2 in mode 0 01-23 12:14:49.350 273-803/? V/ALSADevice: switchDevice: device 0x2 mode:0 01-23 12:14:49.350 273-803/? V/ALSADevice: nonCallOutputRouting: 0x2, mDevSettingsFlag=0x00012012 01-23 12:14:49.350 273-803/? V/ALSADevice: Routing to rx=xLoud Speaker 01-23 12:14:49.350 273-803/? V/ALSADevice: nonCallInputRouting: 0, mDevSettingsFlag=0x00012012 01-23 12:14:49.350 273-803/? V/ALSADevice: Routing to tx=none 01-23 12:14:49.350 273-803/? V/ALSADevice: switchDevice,rxDev:xLoud Speaker, txDev:(null), curRxDev:xLoud Speaker, curTxDev:None 01-23 12:14:49.350 273-803/? D/alsa_ucm: snd_use_case_set(): uc_mgr 0xb7891498 identifier _enadev value xLoud Speaker 01-23 12:14:49.350 273-803/? D/ALSADevice: switchDevice: mCurTxUCMDevivce None mCurRxDevDevice xLoud Speaker 01-23 12:14:49.350 273-803/? D/alsa_ucm: snd_use_case_set(): uc_mgr 0xb7891498 identifier _verb value HiFi Lowlatency 01-23 12:14:49.350 273-803/? D/alsa_ucm: Set mixer controls for xLoud Speaker enable 1 01-23 12:14:49.350 273-803/? D/alsa_ucm: acdb_id 520 cap 1 enable 1 01-23 12:14:49.350 273-803/? D/ACDB-LOADER: ACDB -> send_audio_cal, acdb_id = 520, path = 0 01-23 12:14:49.350 273-803/? D/ACDB-LOADER: ACDB -> send_adm_topology 01-23 12:14:49.350 273-803/? D/ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TOPOLOGY_ID 01-23 12:14:49.350 273-803/? D/ACDB-LOADER: ACDB -> send_audtable 01-23 12:14:49.350 273-803/? D/ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TABLE 01-23 12:14:49.350 273-803/? D/ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_CAL 01-23 12:14:49.350 273-803/? D/ACDB-LOADER: ACDB -> send_audvoltable 01-23 12:14:49.350 273-803/? D/ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_GAIN_DEP_VOLTBL_STEP_COPP 01-23 12:14:49.350 273-803/? D/ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_VOL_CAL 01-23 12:14:49.350 273-803/? D/ACDB-LOADER: ACDB -> AUDIO_SET_AFE_CAL 01-23 12:14:49.350 273-803/? D/alsa_ucm: Setting mixer control: SLIM_0_RX Channels, value: Two 01-23 12:14:49.350 273-803/? D/alsa_ucm: Setting mixer control: RX3 MIX1 INP1, value: RX1 01-23 12:14:49.360 273-803/? D/alsa_ucm: Setting mixer control: RX3 MIX1 INP2, value: RX2 01-23 12:14:49.360 273-803/? D/alsa_ucm: Setting mixer control: LINEOUT1 Volume, value: 100 01-23 12:14:49.370 273-803/? D/alsa_ucm: Set mixer controls for HiFi Lowlatency enable 1 01-23 12:14:49.370 273-803/? D/alsa_ucm: Setting mixer control: SLIMBUS_0_RX Audio Mixer MultiMedia5, value: 1 01-23 12:14:49.370 273-803/? D/ALSADevice: close: handle 0xb78f8738 h 0x0 01-23 12:14:49.370 273-803/? D/ALSADevice: open: handle 0xb78f8738, format 0x2 01-23 12:14:49.370 273-803/? V/ALSADevice: Music case 01-23 12:14:49.370 273-803/? D/ALSADevice: Device value returned is hw:0,14 01-23 12:14:49.370 273-803/? V/ALSADevice: flags 0, devName hw:0,14 01-23 12:14:49.370 273-803/? V/ALSADevice: pcm_open returned fd 31 01-23 12:14:49.370 273-803/? D/ALSADevice: handle->format: 0x2 01-23 12:14:49.370 273-803/? D/ALSADevice: setHardwareParams: reqBuffSize 1024 channels 2 sampleRate 48000 01-23 12:14:49.370 273-803/? D/ALSADevice: setHardwareParams: buffer_size 2048, period_size 1024, period_cnt 2 01-23 12:14:49.400 1254-1254/? D/NativeNfcTag: Check NDEF Failed - status = 255 01-23 12:14:49.400 1254-1254/? D/NfcDispatcher: dispatch tag: TAG: Tech [android.nfc.tech.NfcV] message: null 01-23 12:14:49.400 1254-1254/? E/NfcHandover: invalid NDEF record 01-23 12:14:49.410 1254-1254/? I/NfcDispatcher: no match 01-23 12:14:49.420 270-695/? W/qdhwcomposer: Excessive delay reading vsync: took 6402 ms 

Most confused by the line "E / NfcHandover: invalid NDEF record", because I try to count, not write.

Here is the code by which I try to read the tag:

 public class ActivityRead1 extends Activity { public static final String ERROR_DETECTED = "No NFC tag detected!"; public static final String WRITE_SUCCESS = "Text written to the NFC tag successfully!"; public static final String WRITE_ERROR = "Error during writing, is the NFC tag close enough to your device?"; NfcAdapter nfcAdapter; PendingIntent pendingIntent; Context context; String textNew; Button btnRead; Tag myTag; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_read1); context = this; nfcAdapter = NfcAdapter.getDefaultAdapter(this); if (nfcAdapter == null) { // Stop here, we definitely need NFC Toast.makeText(this, "This device doesn't support NFC.", Toast.LENGTH_LONG).show(); finish(); } btnRead = (Button) findViewById(R.id.buttonRead); btnRead.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { readFromIntent(getIntent()); // Intent intent2 = new Intent(ActivityRead1.this, ActivityRead2.class); // intent2.putExtra("textNew", textNew); // // startActivity(intent2); } }); pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); IntentFilter tagDetected = new IntentFilter(NfcAdapter.ACTION_TAG_DISCOVERED); tagDetected.addCategory(Intent.CATEGORY_DEFAULT); } /**********************************Read From NFC Tag***************************/ private void readFromIntent(Intent intent) { //Toast.makeText(this, "readFromIntent", Toast.LENGTH_LONG).show(); String action = intent.getAction(); if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action) || NfcAdapter.ACTION_TECH_DISCOVERED.equals(action) || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) { Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); NdefMessage[] msgs = null; if (rawMsgs != null) { msgs = new NdefMessage[rawMsgs.length]; for (int i = 0; i < rawMsgs.length; i++) { msgs[i] = (NdefMessage) rawMsgs[i]; } } buildTagViews(msgs); }else { Toast.makeText(this, "ERROR readFromIntent", Toast.LENGTH_LONG).show(); } } private void buildTagViews(NdefMessage[] msgs) { //Toast.makeText(this, "buildTagViews", Toast.LENGTH_LONG).show(); if (msgs == null || msgs.length == 0) { Toast.makeText(this, "msgs == null", Toast.LENGTH_LONG).show(); return; } String text = ""; // String tagId = new String(msgs[0].getRecords()[0].getType()); byte[] payload = msgs[0].getRecords()[0].getPayload(); String textEncoding = ((payload[0] & 128) == 0) ? "UTF-8" : "UTF-16"; // Get the Text Encoding int languageCodeLength = payload[0] & 0063; // Get the Language Code, eg "en" // String languageCode = new String(payload, 1, languageCodeLength, "US-ASCII"); try { // Get the Text text = new String(payload, languageCodeLength + 1, payload.length - languageCodeLength - 1, textEncoding); } catch (UnsupportedEncodingException e) { Log.e("UnsupportedEncoding", e.toString()); } textNew = text.replace("!","\n\n"); startIntent(); } public void startIntent(){ Intent intent2 = new Intent(ActivityRead1.this, ActivityRead2.class); intent2.putExtra("textNew", textNew); startActivity(intent2); } } 

Here is a part of the manifest file (maybe something is wrong here):

 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.pavelpostnikov.application1"> <uses-permission android:name="android.permission.NFC" /> <uses-feature android:name="android.hardware.nfc" android:required="true" /> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher_st" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_st_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".ActivityReadCheck"></activity> <activity android:name=".MainActivity" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".ActivityRead1" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.nfc.action.TECH_DISCOVERED" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> 

I also tried to write and read the tag using other applications. The NFC Tools application performs only the initial reading of the parameters (type, technology, serial number, DSFID. When trying to read information, format the tag, it displays the message "Error. This NFC tag is not supported."

The NfcV-reader application (from ST) easily performs all possible actions. The lines "E / NfcHandover: invalid NDEF record" are not in the logs.

He sinned that the tag does not support NDEF, but the application NfcV-reader and reads and writes NDEF messages.

Please tell me why this tag can not pass through the test (see above)?

    0