Required Permissions

Due to the fact that the required permissions change from operating system version to operating system version, it is not possible to automatically set the required permissions within the SDK.
This must be done within the application.

If this is not done, the user will be prompted when the permissions are required.

Below is an example of how it would be possible to programmatically setup permissions:

public static void setupPermissions()
{
ApplicationPermissionsManager man =
ApplicationPermissionsManager.getInstance();
int[] requiredPerms = new int[]
{
ApplicationPermissions.PERMISSION_EXTERNAL_CONNECTIONS,
ApplicationPermissions.PERMISSION_INTERNAL_CONNECTIONS,
ApplicationPermissions.PERMISSION_LOCATION_API,
ApplicationPermissions.PERMISSION_WIFI
};
ApplicationPermissions perms = man.getApplicationPermissions();
boolean change = false;
for (int i = 0; i < requiredPerms.length; i++)
{
if (perms.containsPermissionKey(requiredPerms[i]))
{
if (perms.getPermission(requiredPerms[i]) !=
ApplicationPermissions.VALUE_ALLOW)
{
change = true;
perms.addPermission(requiredPerms[i]);
}
}
else
{
change = true;
perms.addPermission(requiredPerms[i]);
}
}
if (change)
{
man.invokePermissionsRequest(perms);
}
}

Last edited Jun 20, 2011 at 3:50 PM by bangodev, version 3

Comments

No comments yet.