In short:
On the Huawei Watch 2 it seems like NFC is available and enabled but NFC_FEAUTURE is not, hence nfc is not working properly.
Trying to develop the ability to simply read and display NFC tags on the Huawei Watch 2 raises some difficulties:
mNfcAdapter.enableForegroundDispatch(this,nfcPendingIntent, nfcIntentFilter, null);
raises the error
java.lang.UnsupportedOperationException
That implies the FEATURE_NFC is not available.
In MainActivity onCreate():
mNfcAdapter = NfcAdapter.getDefaultAdapter(this); //NfcAdapter mNfcAdapter
if (mNfcAdapter != null) {
// Check if device supports NFC
Log.i("NFC","Your device supports NFC");
}
// Check if NFC is enabled
if (mNfcAdapter.isEnabled()) {
Log.i("NFC","NFC is Enabled");
}
if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC)) {
// Device compatible for NFC support
Log.i("NFC", "Device compatible for NFC support");
}
shows in console
... I/NFC: Your device supports NFC
... I/NFC: NFC is Enabled
but not
... I/NFC: Device compatible for NFC support
In other words
mNfcAdapter !=null
and
mNfcAdapter.isEnabled() == true
but (getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC) == false
How is this possible?
Btw. my AndroidManifest.xml:
<uses-permission android:name="android.permission.NFC"/>
<uses-feature android:name="android.hardware.nfc" android:required="true" />
see also Android NFC Tutorial and a similar post NFC Android wear (Huawei watch 2.0)
What am I doing wrong? Is NFC on the Huawei Watch 2 somehow locked or disabled?
Thanks in advance for helping.