Site icon Learn C++

Learn About Handling Android32 Permissions In C++

Mobile android applications developed in C++ Builder requires permissions to use some part of mobile devices (sensors, camera etc..). These should be allowed by the user. an these permissions can be checked over the project options from Project > Options > Application > Uses Permissions section. Some of these permissions were listed in this document http://docwiki.embarcadero.com/RADStudio/Rio/en/Uses_Permissions. All Android permission can be found listed officially on Manifest Permission List
Some Basic Android Permissions are Set for All FireMonkey Android Apps

These checks are not enough, You also need to request permission on runtime. Because these permissions should be allowed manually by user and these might be not allowed. For example if you are starting to use camera in your application you must do this request check. To do this u need to Request all permissions you need by using TAndroidHelper::Activity->requestPermissions( ) like this;

[crayon-662a05b4897bf124077424/]

and you must check permissions if it is granted or not by using checkSelfPermission() like this:

[crayon-662a05b4897c5861362077/]

We should show permissions so user can grants manually;

[crayon-662a05b4897c7186343095/]

Android official page has a good article about Request app permissions permissions in Kotlin & Java. C++ Builder uses Helpers to request these permissions as below;

Here is a sample for an Android Application to check permissions

[crayon-662a05b4897c9607863220/]

Exit mobile version