0

I have a Qt android application which requires CAMERA and WRITE_EXTERNAL_STORAGE permissions. So I have the following:

 public class AppActivity extends QtActivity
 {
   private static final String[] PERMISSIONS = {
     android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
     android.Manifest.permission.CAMERA
   };

   private void CheckPermissions()
   {
     ...
     requestPermissions(PERMISSIONS, PERMISSION_ALL);
     ...
   }
   ...
 }

No problem with that, when my application is installed and then launched, it asks for those two permissions.

However, when installation succeeds, there is a screen which lists some permissions, see screenshot below.

enter image description here

How to remove the two permissions Microphone and Location from this screen (they also appear in the Settings parameters screen of the application), as they are not required in my application?

I tried putting in AndroidManifest.xml the following:

    <uses-permission tools:node="remove" android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
    <uses-permission tools:node="remove" android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission tools:node="remove" android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission tools:node="remove" android:name="android.permission.RECORD_AUDIO" />

but it doesn't change anything.

ADM
  • 20,406
  • 11
  • 52
  • 83
SteveTJS
  • 635
  • 17
  • 32
  • 1
    Check manifest for permissions there could be some android library which you are using hold these permissions during manifest merging it will add up to one . I am not aware how QT works BTW but it should not show the permission in app info if not added in manifest – ADM Sep 16 '20 at 09:55
  • You are right, the merged manifest has a lot of permissions: WAKE_LOCK, INTERNET, ACCESS_NETWORK_STATE, ACCESS_FINE_LOCATION, RECORD_AUDIO, ACCESS_FINE_LOCATION, BLUETOOTH, BLUETOOTH_ADMIN, ACCESS_COARSE_LOCATION. And there are not my remove instrucitons in it. – SteveTJS Sep 16 '20 at 10:01
  • Have a look at [This thread](https://stackoverflow.com/questions/27997679/disable-dependency-permissions) it might help . – ADM Sep 16 '20 at 10:05
  • I had a look at all that (tools:node="remove", ...) but nothing, I still have the permissions other than the ones I add in my main AndroidManifest. For example, if I add in my main manifest, to remove the auto added , both lines appear in the final manifest and installation failed (package invalid). – SteveTJS Sep 16 '20 at 12:58
  • 1
    Thanks for your comments @ADM , I learnt a lot of things about permissions. I found the answer, I'll post it, and ... shame on me in some ways :). – SteveTJS Sep 16 '20 at 15:13

1 Answers1

1

OK, so it's a Qt specific way to handle permissions.

In the main generated AndroidManifest.xml by Qt for a project, there is the following comment:

    <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
     Remove the comment if you do not require these default permissions. -->

So ... just remove the comment! And put the permissions you need. As it is said, all permissions from dependencies will be removed, and consequently, only yours will appear at application installation.

SteveTJS
  • 635
  • 17
  • 32