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

Android™ Runtime Development

Reply
Regular Contributor
_NishantShah
Posts: 76
Registered: ‎07-31-2012
My Device: Blackberry
My Carrier: Vodafone
Accepted Solution

Can not fetch location using network provider

Hi all,

 

My android application uses location updates and works fine on Android device. I ported my application on BB 10, I can get location updates using GPS_PROVIDER but not using NETWORK_PROVIDER. Did anybody manage to find location using network provider?

 

Regards,

Nishant Shah

Please use plain text.
New Contributor
jmbusby
Posts: 6
Registered: ‎03-12-2013
My Device: BlackBerry Z10, BlackBerry PlayBook
My Carrier: None

Re: Can not fetch location using network provider

I am having the same issue with NETWORK_PROVIDER. Haven't tried GPS_PROVIDER as my app doesn't use GPS. I am getting no updates on my LocationListener, and when I query the LocationManager for a last known position I also get nothing.

Please use plain text.
Regular Contributor
Fraggle222
Posts: 84
Registered: ‎01-31-2013
My Device: Simulator !!!
My Carrier: 8608800458

Re: Can not fetch location using network provider

Do either of you have an actual Z10 (with cell service activated)?

 

Also, can you verify that you are not getting any location updates even if you use 

 

LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);

lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0F, this);

 

 //then

public void onLocationChanged(Location location) {

//Got a location if this method is called.

}

 

GPS locations are definitely working using this techique, not sure about NETWORK_PROVIDER. However, using Last Known Location method seems to return null.

Please use plain text.
New Contributor
jmbusby
Posts: 6
Registered: ‎03-12-2013
My Device: BlackBerry Z10, BlackBerry PlayBook
My Carrier: None

Re: Can not fetch location using network provider

Yes, I have an actual Z10. It does not have cell service activated, but this should not matter. It is connected to wifi and should get network location from that.

 

I can verify that I have exactly the code you describe in my app to get network location updates, with the associated listener, and I am not receiving any calls to onLocationChanged().

 

I have also noticed that according to the Z10, my application has GPS location permission, but not regular location permission. This seems wrong as my AndroidManifest requests COARSE_LOCATION only. Perhaps this is the root problem - without permission, the LocationManager will not return any updates? In which case, how do I fix that?

Please use plain text.
Regular Contributor
Fraggle222
Posts: 84
Registered: ‎01-31-2013
My Device: Simulator !!!
My Carrier: 8608800458

Re: Can not fetch location using network provider

I'm pretty sure wi-fi does not imply the ability to get a location. I mean it will try, but how does Blackberry know where your wi-fi router is. If this were a regular Android device, maybe it would query Google's massive database.So not having cell service could be the issue.

As for the permissions, I would just add the FINE LOCATION permission and see if that changes anything, however, I suspect your issue is expecting BB to return a location based on your wi-fi router.
Please use plain text.
New Contributor
jmbusby
Posts: 6
Registered: ‎03-12-2013
My Device: BlackBerry Z10, BlackBerry PlayBook
My Carrier: None

Re: Can not fetch location using network provider

I assumed that BlackBerry had a similar system to Google for geo-locating a wifi connection. However, I have tested with cell service, and it still does not work (I get no coarse location updates), so I don't think this is the problem.

 

GPS location is working fine. However, I don't need or want to use that for my app if possible.

Please use plain text.
Regular Contributor
_NishantShah
Posts: 76
Registered: ‎07-31-2012
My Device: Blackberry
My Carrier: Vodafone

Re: Can not fetch location using network provider

Hi Fraggle222,

 

I have a dev alpha B. Cell service is activated. But it doesn't work for me. I also tried fetching location using HTML5 Geolocation api, it did work on Android device, it failed on BB 10 OS.

 

Regards,

Nishant Shah

Please use plain text.
New Contributor
jmbusby
Posts: 6
Registered: ‎03-12-2013
My Device: BlackBerry Z10, BlackBerry PlayBook
My Carrier: None

Re: Can not fetch location using network provider

According to support:

"This is a known issue it is in the process of being fixed with internal development. "
Please use plain text.
New Contributor
gopalakrishnans
Posts: 8
Registered: ‎04-26-2013
My Device: Z10
My Carrier: AT&T

Re: Can not fetch location using network provider

Hi,

Is there a ticket already open for this?

 

Thanks

Please use plain text.
BlackBerry Development Advisor
bbenninger
Posts: 130
Registered: ‎04-19-2013
My Device: BlackBerry Z10

Re: Can not fetch location using network provider

It was addressed in OS 10.1

Please use plain text.