Let me also add that the location listener does sometimes get calls to
onProviderEnabled -- this happens after asking the user to enable
wireless network locations if initially disabled. So I know for sure
that the listener is registered correctly. It just never gets an
onLocationChanged call.

/Michael.

On Nov 29, 10:10 pm, michael <[email protected]>
wrote:
> Hi folks,
>
> I have a location listener running in a foreground service. The
> listener registers for wireless network updates in its constructor. In
> the majority of cases, location updates are received as expected.
>
> However, log entries from the live app show that for about 5% of my
> users, location updates are never received even though wireless
> network location is enabled on the phone (I check this through the
> LocationManager.isProviderEnabled method). That is, onLocationChanged
> is never called, at least not within say 20 minutes of registering the
> listener.
>
> Does anybody have any idea why this might be? Are there cases, or
> certain geographic areas, where you would not expect wireless
> locations to be available?
>
> A stripped-down outline of the location listener code is shown below:
>
> class MyLocationListener extends LocationListener {
>     private Location mLocation = null;
>
>     public MyLocationListener() {
>         mLocMan = (LocationManager)
> getSystemService(Context.LOCATION_SERVICE);
>
>         if (mLocMan.getLastKnownLocation(mCoarseLocationProvider) !=
> null) {
>             mCurrentLocation =
> mLocMan.getLastKnownLocation(mCoarseLocationProvider);
>         }
>
>         LocationProvider lp =
> mLocMan.getProvider(LocationManager.NETWORK_PROVIDER);
>         mLocMan.requestLocationUpdates(lp.getName(), 0, 0, this);
>     }
>
>     public void onLocationChanged(Location loc) {
>         mLocation = loc;
>     }
>
> }
>
> I verify through flurry logs that the "network" location provider is
> indeed obtained and enabled, and that mLocation == null after about 20
> minutes.
>
> Any suggestions would be enormously appreciated. I am running out of
> ideas for how to fix this, and I cannot replicate the issue on my own
> test devices.
>
> Cheers,
> Michael.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to