views:

202

answers:

1

During development testing of my app I'm running into a strange issue where new builds (Build 2.0) of the exact same code base suddenly default permissions (carrier internet, gps) to be Prompt rather than Allow on install.

Details -- Same code base
So there exists two builds, both with the same code base. Build 1.0 was made/signed last week. Build 2.0 was made/signed yesterday. If I install Build 1.0, no issues with initial permissions (all Allow). But on install of Build 2.0 the same permissions (carrier internet, gps) are set to Prompt.

Questions
The app does make gps & data requests and I do understand that some phone configurations require permissions to be set, but why would a build that previously didn't need permissions (Build 1.0) all of a sudden require them (Build 2.0)?

I assume it might have to do with my project/build settings but I'm not sure what. Any suggestions?

+3  A: 

Is it possible you did something on your device between 1.0 and 2.0 that would cause this, such as turning on your firewall?

As far as I know, there isn't anything you can do at build, download, or install time to set or query the permissions for an app. You need to wait until it actually runs before you have any control to query or request changes to the app permissions.

You might want to try putting the following snippet of code in the initialization of your application, to take a peek at what the settings are actually set to:

ApplicationPermissionsManager apm = ApplicationPermissionsManager.getInstance();
ApplicationPermissions permissions = apm.getApplicationPermissions();
int[] keys = permissions.getPermissionKeys();
for (int i = 0; i < keys.length; i++) {
    int key = keys[i];
    System.out.println("APM: " + key + " = " +
  permissionToString(permissions.getPermission(key)));
}

and:

public String permissionToString(int value) {
    switch(value) {
     case ApplicationPermissions.VALUE_ALLOW:
      return "ALLOW";
     case ApplicationPermissions.VALUE_PROMPT:
      return "PROMPT";
     case ApplicationPermissions.VALUE_DENY:
      return "DENY";
     case -1:
      return "NOT_SET";
     default:
      return Integer.toString(value);
    }
}

The "applicationpermissionsdemo" program in the JDE samples directory has a good example of querying for app permissions and requesting changes to app permissions from the app itself.

Marc Novakowski