androidapilocationlocation-provider

Location updates not working indoors as claimed by Fusion Location Provider APIs


Issue:

Location updates not working indoors as claimed by Fusion Location Provider APIs.

What happened:

  1. I tried implementing the latest location API to get location updates using LocationClient in my Android App.
  2. My android app works fine with out any issue while I am testing outdoor.
  3. But when testing indoors (inside any building), then no location updates are happening.

Expected behavior:

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).

I see that latest Google Maps android app works fine indoors with estimated location.

Question:

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).

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)

Below is the android code that I applied to get location updates using new APIs:

Step1:

mLocationClient = new LocationClient(this, this, this);

Step2:

// 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);

Step3: inside onStart() method - below line is added:

// Connect the client.
mLocationClient.connect();

Step4: inside onConnected() method - below line is added:

mLocationClient.requestLocationUpdates(mLocationRequest, this);

Step5: inside onLocationChanged() method - listening for location updates. This method is not called when testing insides. This method is getting called only when GPS signal is found.

double lat = location.getLatitude();
double lng = location.getLongitude();

Finally added below permissions in Android Manifest:

 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

Solution

  • After long testing and debugging on HTC One X (4.1.1), I decided to try same test cases on any other phone model. Luckily my app worked indoors too when testing with my friend's Samsung S3 (4.1.1). At same time and location, when I tested with my HTC One X, I do not get location indoors. Both phones are set with same settings (WiFi/GPS/Mobile network all enabled).

    To confirm this is an issue with specific device, I performed many tests inside the building at different corners using my app and I see the same issue on my HTC at all indoor locations (but at same locations S3 gets the indoor location).