Note that there are some explanatory texts on larger screens.

plurals
  1. POFused Location Provider in Android
    primarykey
    data
    text
    <p>I am developing an app using Fused Location Provider. I have a doubt. For getting location in regular intervals it uses requestLocationUpdates(). But from which source is it get the location either from WIFI or GPS or Network. In my app, it gets location in regular intervals only when WiFi is ON. When WiFi is in OFF state, then it can't get the location(it supposed to get location from some other source either form GPS or Network. But it never get location. Or i have to write listeners for GPS and Network). I don't know what is the problem. Can anyone help me.</p> <p>And, whether it works only when all the providers(Wifi,GPS,Network) available or else.</p> <pre><code>public void checkPlay(){ int resp = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if (resp == ConnectionResult.SUCCESS) { locationClient = new LocationClient(this, this, this); locationClient.connect(); } else { Toast.makeText(this, "Google Play Service Error " + resp, Toast.LENGTH_LONG).show(); } } public void onConnected(Bundle arg0) { // TODO Auto-generated method stub if (locationClient != null &amp;&amp; locationClient.isConnected()) { locationRequest = LocationRequest.create(); locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); locationRequest.setInterval(100); locationClient.requestLocationUpdates(locationRequest, this); } } public void onLocationChanged(Location location) { // TODO Auto-generated method stub try { if (location != null) { lat = location.getLatitude(); long = location.getLongitude(); } } catch (Exception e) { Log.d(Fots.TAG, "GpsTrackService.mGpsLocationListener.onLocationChanged", e); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload