Example code for applying for Android permissions in QT 6.5.3.
-
wrote on 7 Nov 2024, 04:30 last edited by
Hey everyone! I'm currently working on a project using QT 6.5.3 and I need to apply for Android permissions. But I'm kind of stuck and not sure how to do it exactly. Does anyone have some example code for applying for Android permissions in QT 6.5.3 that they could share with me? Thanks a lot in advance!
-
Take a look at https://doc.qt.io/qt-6/permissions.html
-
Take a look at https://doc.qt.io/qt-6/permissions.html
wrote on 7 Nov 2024, 08:04 last edited by@jsulm Thank you very much for your answer. QT6 already has only these few permissions built-in.(QBluetoothPermission,QCalendarPermission,QCameraPermission,QContactsPermission,QLocationPermission,QMicrophonePermission)
If I want to apply for Wi-Fi permission, specifically "android.permission.CHANGE_WIFI_STATE", I don't know how to achieve it. And for other permissions that are not built-in, how can I apply for them? -
@jsulm Thank you very much for your answer. QT6 already has only these few permissions built-in.(QBluetoothPermission,QCalendarPermission,QCameraPermission,QContactsPermission,QLocationPermission,QMicrophonePermission)
If I want to apply for Wi-Fi permission, specifically "android.permission.CHANGE_WIFI_STATE", I don't know how to achieve it. And for other permissions that are not built-in, how can I apply for them?@Gracy Try to add the permissions to AndroidManifest.xml. But I don't know how you can check whether the permission was granted.
-
@Gracy Try to add the permissions to AndroidManifest.xml. But I don't know how you can check whether the permission was granted.
wrote on 7 Nov 2024, 09:01 last edited byI've tried it.
QT6.5.3 automatically generates XML files, and manual modifications don't take effect.
In addition, I have tried adding the permission in the.pro file ,by adding "ANDROID_PERMISSIONS += android.permission.CHANGE_WIFI_STATE" or ANDROID_MANIFEST method, but neither of them has been successful.
1/5