Details
-
Suggestion
-
Resolution: Done
-
P3: Somewhat important
-
5.10.1, 5.11.0 Beta 2
-
None
Description
We need to know if a smartphone has NFC and if it is enabled. To show better user information we need to differ between this state.
It would help a lof if the QtNFC API would support it. I would commit a changeset to gerrit to add "isEnabled" and change "isAvailable". But that would change the existing isAvailable behaviour a little bit. Would that be ok?
diff --git a/src/android/nfc/src/org/qtproject/qt5/android/nfc/QtNfc.java b/src/android/nfc/src/org/qtproject/qt5/android/nfc/QtNfc.java index 345b87d3..1ff752e5 100644 --- a/src/android/nfc/src/org/qtproject/qt5/android/nfc/QtNfc.java +++ b/src/android/nfc/src/org/qtproject/qt5/android/nfc/QtNfc.java @@ -161,6 +161,11 @@ public class QtNfc static public boolean isAvailable() { + return m_adapter != null; + } + + static public boolean isEnabled() + { if (m_adapter == null) { //Log.e(TAG, "No NFC available (Adapter is null)"); return false;
Of course.... every usage in qt would be switched to isEnabled and there are more API layer that needs to be added.....