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.....
Attachments
For Gerrit Dashboard: QTBUG-62169 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
222399,4 | Add NFC API method isSupported | dev | qt/qtconnectivity | Status: MERGED | +2 | 0 |
222702,1 | QtNFC differ between available and enabled | 5.11 | qt/qtconnectivity | Status: ABANDONED | 0 | 0 |
223763,1 | Add since command in documentation for new API method | 5.11 | qt/qtconnectivity | Status: ABANDONED | 0 | 0 |
223765,2 | Add since command in documentation for new API method | dev | qt/qtconnectivity | Status: MERGED | +2 | 0 |