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
Developer
Posts: 283
Registered: ‎07-22-2008
My Device: Not Specified
Accepted Solution

invokePermissionsRequest generating an exception

I am using the following to invoke the permission dialog:

 

acceptance = ApplicationPermissionsManager.getInstance().invokePermissionsRequest( permRequest );

 

If while it is displayed, I hit the red button to go back to the home screen, the dialog is pushed to the background and is not visible anymore. Then if I go back to may application and try to execute the line above, it will generate an exception: "object already exists"

 

Which means ( to my undestanding) that the dialog is already up and running.

The problem is how to bring the dialog to the foreground, or how to close it  before calling invokePermissionsRequest().

 

Once this happens the app is stuck and cannot move forward.

 

Any suggestion?

 

Thanks

 

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

Re: invokePermissionsRequest generating an exception

Any suggestions?

 

 

Thanks

Developer
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: invokePermissionsRequest generating an exception

Putting more code will help us..

 

Well, make a check before like this

 

if(acceptance==null)

acceptance= ApplicationPer...................; 

 

Cheers.. 

--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
Developer
Posts: 16,842
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: invokePermissionsRequest generating an exception

can you switch to the dialog in question using the taskmanager (alt+ESC)?
if not i would suggest to report this issue using the bugtracker
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Developer
Posts: 283
Registered: ‎07-22-2008
My Device: Not Specified

Re: invokePermissionsRequest generating an exception

Thanks for the reply.

The code I am using is straight forward. Here is the function:

 

 

public static boolean setPermissions() throws Exception { ApplicationPermissions original = ApplicationPermissionsManager.getInstance().getApplicationPermissions(); try { ApplicationPermissions permRequest = new ApplicationPermissions(); permRequest.addPermission( ApplicationPermissions.PERMISSION_EXTERNAL_CONNECTIONS); acceptance = ApplicationPermissionsManager.getInstance().invokePermissionsRequest( permRequest ); return acceptance; } catch(Exception e) { System.out.println(" Exception in setPermissions :"+e.getMessage()); throw new Exception("exception in set permissions: " + e.getMessage()); } }

 

acceptance is just a boolean.

 

It looks that when invokePermissionsRequest() is called, it pops up the BB permission Dialog, but if it is not closed by the user using ( save,cancel,abort). It stays up and any call to subsequent invokePermissionsRequest() from the same application or from another completely different application would generate the exception.

 

So if it is that global and is opened using invokePermissionsRequest(), Is there a way to close it or push it to the foreground from the application program.

 

I tried to raise the module "net_rim_bb_application_permissions_proxy" when this happens but it does not seem to work.

 

Thanks

Developer
Posts: 304
Registered: ‎08-01-2008
My Device: Not Specified

Re: invokePermissionsRequest generating an exception

In general you should not worry about this error - its the rarest of rare cases when a user would press the cancel button on the permissions screen.

 

To set the permissions, blackberry runs an entirely different application - to prevent your application from maliciously changing the permissions.

 

If you still want to handle it, try doing a search for visible applications using ApplicationManager and when you find the application descriptor for net_rim_bb_application_permissions_proxy, find out its process id using getProcessId() and then do a request foreground for that process id.

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

Re: invokePermissionsRequest generating an exception

This is exactly what I am doing by saying in my previous message: "<< I tried to raise the module "net_rim_bb_application_permissions_proxy" >>. But it doesn't seem to work. I will try it again.

 

Thanks

BlackBerry Development Advisor
Posts: 15,302
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: invokePermissionsRequest generating an exception

This is an issue our development team is aware of.  If the application permission screen is closed using the End key the user can not task switch back to it, nor can they start the application that made the permission request.  They'll need to reset their BlackBerry smartphone (pull the battery) in order to restart the application.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 78
Registered: ‎12-22-2010
My Device: Not Specified

Re: invokePermissionsRequest generating an exception

Hello,

 

Is there any particular software version since which this issue has been resolved?

 

Thanks!

Highlighted
New Contributor
Posts: 2
Registered: ‎04-06-2013
My Device: torch 9800
My Carrier: Claro

Re: invokePermissionsRequest generating an exception

My solution was to create any screen. After pushing the save button, this screen is showed, but with the close() I finished cleaning the display.

 

pushScreen(new ShotMS());

 

if (manager.invokePermissionsRequest(permissions)){
. . . . . . . . . 

. . . . . . . . .

                                synchronized (UiApplication.getEventLock()) {

                                UiApplication.getUiApplication().getActiveScreen().close();
                                }

}