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

Posts: 70
Registered: ‎04-20-2012
My Device: BB 9105
My Carrier: Vodafone

LocationListener's providerStateChanged() doesn't work



I am writing an application which should report when device GPS status is changed (i.e. if someone disables GPS from Location Settings). Ideally, when Locaiton is set to 'Off' from LocationSettings, providerStateChanged() function should be called. In my case, it is not being called unfortunately.


I am doing:

myProvider.setLocationListener(new myLocationListener(),0, -1, -1);  


Please note timeout to '0' only notifies for providerstatechanged.


however, if I use

myProvider.setLocationListener(new myLocationListener(), -1, -1, -1); , 

I get this function called with new state as GPS Temporirly unavailable, but enabling GPS again from location settings does not call this function with GPS available.


Am I missing something here.




Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: LocationListener's providerStateChanged() doesn't work