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

Web and WebWorks Development

Reply
New Contributor
Posts: 9
Registered: ‎08-04-2011
My Device: BlackBerry Torch 9800
Accepted Solution

How can I block the alert that appears when trying to access the GPS coordinates?

I'm developing an application that access to GPS coordinates, and when I try to access appear a message that says "A JavaScript has requested the physical location of your device. Do you wish to provide this to the script? Can I block this alert?

Developer
Posts: 35
Registered: ‎05-20-2011
My Device: Z10 and 32GB Playbook

Re: How can I block the alert that appears when trying to access the GPS coordinates?

If you use HTML5 geolocation API (lots of examples on a google search) instead of blackberry.location.latitude etc you will only be prompted the first time.
New Contributor
Posts: 9
Registered: ‎08-04-2011
My Device: BlackBerry Torch 9800

Re: How can I block the alert that appears when trying to access the GPS coordinates?

I'm using the same, but I need that this alert don't appear or else ask with a script if the application has permissions, does anybody have any idea?

Developer
Posts: 35
Registered: ‎05-20-2011
My Device: Z10 and 32GB Playbook

Re: How can I block the alert that appears when trying to access the GPS coordinates?

My app (MyNGR - available free on AppWorld) does not exhibit this behavior with the prompts. If you find that it behaves the way you need I'll provide code.
New Contributor
Posts: 9
Registered: ‎08-04-2011
My Device: BlackBerry Torch 9800

Re: How can I block the alert that appears when trying to access the GPS coordinates?

I will be grateful if you could give me the portion of code that retrieves the coordinates to compare agains mine because I'm using navigator.geolocation.getCurrentPosition( success, fail, options ) and the alert appear every time that I call this sentence.