correctly announce fused location as "fused"

This commit is contained in:
Marvin W 2016-07-08 23:56:58 +02:00
parent 1eeeb0bcd3
commit bee7bc9867
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A
1 changed files with 5 additions and 4 deletions

View File

@ -91,16 +91,18 @@ public class LocationRequestHelper {
return true; return true;
} }
} }
lastReport = new Location(location);
lastReport.setProvider("fused");
Log.d(TAG, "sending Location: " + location); Log.d(TAG, "sending Location: " + location);
if (listener != null) { if (listener != null) {
try { try {
listener.onLocationChanged(location); listener.onLocationChanged(lastReport);
} catch (RemoteException e) { } catch (RemoteException e) {
return false; return false;
} }
} else if (pendingIntent != null) { } else if (pendingIntent != null) {
Intent intent = new Intent(); Intent intent = new Intent();
intent.putExtra("com.google.android.location.LOCATION", location); intent.putExtra("com.google.android.location.LOCATION", lastReport);
try { try {
pendingIntent.send(context, 0, intent); pendingIntent.send(context, 0, intent);
} catch (PendingIntent.CanceledException e) { } catch (PendingIntent.CanceledException e) {
@ -108,12 +110,11 @@ public class LocationRequestHelper {
} }
} else if (callback != null) { } else if (callback != null) {
try { try {
callback.onLocationResult(LocationResult.create(Arrays.asList(location))); callback.onLocationResult(LocationResult.create(Arrays.asList(lastReport)));
} catch (RemoteException e) { } catch (RemoteException e) {
return false; return false;
} }
} }
lastReport = location;
numReports++; numReports++;
return numReports < locationRequest.getNumUpdates(); return numReports < locationRequest.getNumUpdates();
} }