Note that there are some explanatory texts on larger screens.

plurals
  1. POLocation updates not working indoors as claimed by Fusion Location Provider APIs
    text
    copied!<p><strong>Issue:</strong></p> <p>Location updates not working indoors as claimed by Fusion Location Provider APIs.</p> <p><strong>What happened:</strong> </p> <ol> <li>I tried implementing the latest location API to get location updates using <code>LocationClient</code> in my Android App.</li> <li>My android app works fine with out any issue while I am testing outdoor.</li> <li>But when testing indoors (inside any building), then no location updates are happening.</li> </ol> <p><strong>Expected behavior:</strong></p> <p>As per the new APIs, I am expecting to get some estimated location around the building while I am indoors (as GPS do not find the satellite signal for accurate location).</p> <p>I see that latest Google Maps android app works fine indoors with estimated location. </p> <p><strong>Question:</strong></p> <p>What else do I have to take care using new location APIs to get the location update indoors (accurate location is not required, low accuracy is also fine).</p> <p>I am implementing the Android App using Android 4.2.2 version APIs. I am testing on HTC One X (OS v 4.1.1)</p> <p><strong>Below is the android code that I applied to get location updates using new APIs:</strong></p> <p>Step1: </p> <pre><code>mLocationClient = new LocationClient(this, this, this); </code></pre> <p>Step2:</p> <pre><code>// Create the LocationRequest object mLocationRequest = LocationRequest.create(); // Use high accuracy mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); // Set the update interval to 5 seconds mLocationRequest.setInterval(UPDATE_INTERVAL); // Set the fastest update interval to 1 second mLocationRequest.setFastestInterval(FASTEST_INTERVAL); </code></pre> <p>Step3: inside <code>onStart()</code> method - below line is added:</p> <pre><code>// Connect the client. mLocationClient.connect(); </code></pre> <p>Step4: inside <code>onConnected()</code> method - below line is added:</p> <pre><code>mLocationClient.requestLocationUpdates(mLocationRequest, this); </code></pre> <p>Step5: inside <code>onLocationChanged()</code> method - listening for location updates. This method is not called when testing insides. This method is getting called only when GPS signal is found.</p> <pre><code>double lat = location.getLatitude(); double lng = location.getLongitude(); </code></pre> <p>Finally added below permissions in Android Manifest:</p> <pre><code> &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; </code></pre>
 

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