11-20-2009 11:55 AM
Hello,
I want to set my application permissions at startup, but I can't find which permissions to set...
These are the permissions I need:
- Connection (Bluetooth, wifi)
- Inject events
- read/write files
Can someone tell me which permissions I have to check? Or where I can find the info I need? The API's don't give any information on the meaning of the properties...
Solved! Go to Solution.
11-20-2009 11:03 PM
You want to take a look at "net.rim.device.api.applicationcontrol", take a look at the classes and interface.
I have one application that sets permissions at startup, the main function creates and pushes a screen. In the screen's constructor I call super(); followed by a call to setupPermissions();
private void setupPermissions()
{
ApplicationPermissionsManager man = ApplicationPermissionsManager.getInstance();
int[] requiredPerms = new int[] { ApplicationPermissions.PERMISSION_MEDIA, ApplicationPermissions.PERMISSION_RECORDING, ApplicationPermissions.PERMISSION_FILE_API };
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);
}
}Though I don't have it implemented I would like to implement ReasonProvider because it drives me nuts when a application requires a permission for something that seems totally unrelated to the application (such as a calculator that requires BlueTooth access. Why?).
As for what you need:
11-20-2009 11:09 PM
You can look at this link for the API reference 4.6.1
Then look at the API call ApplicationPermissions
You need these :
11-23-2009 04:35 AM
When I invoke the permissions request, I get the following Dialog:
"Application downloads or admin changes require device to reboot for approx 2 minutes. Device inoperable for voice, data and 911 while rebooting. Notice 1 of 5." REBOOT NOW / REBOOT LATER
Why do I get this and how can it be avoided...
11-23-2009 06:20 AM
I have another problem: my application has all permissions set to allow and still DeviceInfo.canResetSecurityTimer() returns false...
I have set my application properties manually in Options > Advanced options > Application permissions
Could the above problem be related to the fact that my app is not visible in the application list (but it is available when I press Menu > Modules)?
Thanks in advance
11-24-2009 03:19 AM
Anyone?
11-24-2009 06:54 AM
The device needs to reboot if you have system listeners (I think). Just an educated guess: When you apply for permission changes to be applied the COD module must be "reloaded" but because you have a system listener or your app is a dependency for another app (those are the reasons why a BlackBerry would need to restart) the module cannot just be reloaded it needs the device to restart to prevent breaks in functionality. I don't know how to avoid this when doing application permissions at run time instead of install time (you know, you install an application and before it even downloads it asks you to accept a set of permissions).
As for the "canResetSecurityTimer" I don't see that in my documentation. Just from the name you would need to set the PERMISSION_IDLE_TIMER permission. Wait, "Idle Timer", I have that. If that is what you are trying to do then check the documentation because it explains the logic for determining if it returns true or false.
11-24-2009 07:00 AM
The method is indeed DeviceInfo.canResetIdleTime() (sorry for the mistake)
How can you set permissions at install time?
11-24-2009 09:09 AM - edited 11-24-2009 09:09 AM
Not sure if this is the best way. You could have an alternate entrty point into your app that runs on startup and just have it check the permiissions and then exit. This may get run at install time.
11-24-2009 09:16 AM
The reason why I need to reset the Security timer is because my app is a video-playing app. If I want to show videos that are longer then the lock-timout, I need to be able to reset the timer (or the lock screen is showed while the video is playing).
Am I correct when I say that on BB devices that have ALLOW_RESET_IDLE_TIMER false in their IT Policy, it is not possible the prevent the lock screen from showing?