Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
misty83
Posts: 745
Registered: ‎01-04-2009
My Device: 8300, 8800, 8700f, 9000

ApplicationPermissions not working on every bb

hi, i'm writing an application, which at the beginnig should ask user if he wants to change privileges (only if they are different than 'allow'). i tested this code under bb 8800, with software 4.5.0.55 and it is ok. but under bb 9000 with software 4.6.0.164 privileges are not remebered! and application asks about them every time i run it! here is this code:

 

ApplicationPermissions original = ApplicationPermissionsManager.getInstance().getApplicationPermissions();

 

 

if( original.getPermission( ApplicationPermissions.PERMISSION_EVENT_INJECTOR ) != ApplicationPermissions.VALUE_ALLOW ||

original.getPermission( ApplicationPermissions.PERMISSION_PHONE ) != ApplicationPermissions.VALUE_ALLOW ||original.getPermission( ApplicationPermissions.

PERMISSION_CHANGE_DEVICE_SETTINGS ) != ApplicationPermissions.VALUE_ALLOW ||

original.getPermission( ApplicationPermissions.PERMISSION_EMAIL ) != ApplicationPermissions.VALUE_ALLOW ) {

 

 

ApplicationPermissions permRequest = new ApplicationPermissions();permRequest.addPermission( ApplicationPermissions.

PERMISSION_EVENT_INJECTOR );

permRequest.addPermission( ApplicationPermissions.PERMISSION_PHONE );permRequest.addPermission( ApplicationPermissions.

PERMISSION_CHANGE_DEVICE_SETTINGS );permRequest.addPermission( ApplicationPermissions.PERMISSION_EMAIL );

 

ApplicationPermissionsManager zet = ApplicationPermissionsManager.getInstance();

 

zet.invokePermissionsRequest( permRequest );

 

 

do You maybe know what is the problem?

also, i've noticed, that under bb9000 with software 4.6.0.164 command System.exit(0) (which i usually use to exit an application) does not work properly.. do You know why?

 

regards

Developer
Developer
rab
Posts: 283
Registered: ‎07-22-2008
My Device: Not Specified

Re: ApplicationPermissions not working on every bb

The same thing happened with me when I run version 4.2 code on 4.6+.

The permission starts behaving like you described. My own conclusion is that the permission class is not compatible anymore. I know for facts that they have added and combined some flags.

If you compile your code without changes on 4.6, it will behave fine on the BB 9000.

The work around that I did was to relax my constraints and accepted what ever is not deny, instead of requiring "Allow".

And if it is prompt, the user will be prompted which is the reason I had the permission dialog to avoid this scenario.

 

Please let us know if you find a better solution.

 

Rab

Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: ApplicationPermissions not working on every bb

The API was broken on 4.2.1 when it was first introduced.

 

This is a known issue acknowledged by RIM.

 

The only work-around (that I have been able to find) is to check the settings after the startup sequence and put up a detailed prompt instructing the user on how to set the permissions manually.

 

Not a good answer but that's all I've got.  :smileyhappy:

 

 

 

Developer
soonthor
Posts: 25
Registered: ‎07-02-2008
My Device: Not Specified

Re: ApplicationPermissions not working on every bb

Hi RexDoug or anyone,

 

I think I might be experiencing permission problem on 9000. You mentioned that it's a known issue when using JDE 4.2.1. Do you know where I can find detail information about the problem?  Thank you for your help. 

Developer
Walibi33
Posts: 70
Registered: ‎11-30-2009
My Device: Not Specified

Re: ApplicationPermissions not working on every bb

Hi,

 

I know this is an old thread but has any solution about this issue ever been released yet ? I kinda get the same problem with the application I work on : as soon as I've modified my permissions by switching one from 'allow' to 'deny' I check my application permissions values and they're all still set to 'allow' !

 

Which is really weird because like some bunch of instructions later I do the same check and the permission value modification is then well taken into account...

 

So I naturally wonder : is there any specific instruction that would "commit" these permissions values modifications ?

 

I've tried to make the current thread sleep or even try to synchronize my code to the ApplicationPermissionsManager instance but nothing works...

 

Thanks in advance.