If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
New Contributor
atomicmethods
Posts: 7
Registered: ‎03-09-2013
My Device: Developer
My Carrier: Telenor

Wait for user to select security option on prompt

Security prompt goes background when I create new instance of BarcodeScaner class.

It appears and viewFinder goes Foreground(on top of it)and user cannot select desired option for security.

I assume that somehow we need to synchronize thread with security prompt and wait for user to finish.

Something like:

synchronized(prompt){

this.wait();

}

 

Or GlobalEventListener is solution?

 

Thanks in advance

Atomic Methods
Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: Wait for user to select security option on prompt

I suggest the appropriate approach is to ask for the Permissions that you want, right up front (at application start-up) and not try things like this unless you know you have the appropriate permissions.

 

The ApplicationPermissionDemo is a good sample to use for this. 

Please use plain text.
New Contributor
atomicmethods
Posts: 7
Registered: ‎03-09-2013
My Device: Developer
My Carrier: Telenor

Re: Wait for user to select security option on prompt

Ok,in that case,it should work.But regarding App Manager for Middle for example,app stops executing until user select security option,and than continue,that is exact behavior for Player class when accessing Media just wonder how to synchronize with App Manager for UiApplication to get same result?If prompt is called from Manager thread,than it is possible to synchronize with that thread a wait to finish(wait for user to select option)and then continue executing code that changes screen and show viewFinder of BarcodeScaner class.I will try to write code for granting permissions,and post the result.Also,I want to have full control of app behavior including interaction with App Manager,because when I run my example code for BarcodeScaner and security prompt is shown and hide after few seconds,it really looks like bug,and than is exactly behavior that I don't want in my app:smileyhappy:

Thanks for replay

Atomic Methods
Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: Wait for user to select security option on prompt

I agree that the behavior you see can be different depending on what application you are running.  For example, the network interaction will wait but screen shot will fail and supply you with a blank image.  This inconsistency is why I recommend that you do not wait till the permissions is requested, but do it in a consistent way at application start up. 

 

Sorry I have no experience of Barcode scanner class and how it interacts, so I have no if there is a work around that will get it to behave as you want. 

Please use plain text.
BlackBerry Development Advisor
PBernhardt
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: Wait for user to select security option on prompt

Peter is correct, you should be manually requesting the permissions your app needs before you try and use them. All at once is fine before the app starts, but you can also do it such that before you do something that needs permissions prompt the user, and then if it's granted, try and do what you were going to do in the first place.

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
Please use plain text.