Add internal FusedLocationProviderResult callback

This commit is contained in:
Thibaut Girka 2016-07-08 10:27:00 +02:00 committed by Marvin W
parent c967701c23
commit 1eeeb0bcd3
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A
2 changed files with 13 additions and 0 deletions

View File

@ -21,12 +21,15 @@ import android.app.PendingIntent;
import android.content.Context;
import android.location.Location;
import android.location.LocationManager;
import android.os.RemoteException;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.widget.Toast;
import com.google.android.gms.R;
import com.google.android.gms.location.ILocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.internal.FusedLocationProviderResult;
import com.google.android.gms.location.internal.LocationRequestUpdateData;
import org.microg.gms.common.Utils;
@ -155,6 +158,12 @@ public class GoogleLocationManager implements LocationChangeListener {
public void updateLocationRequest(LocationRequestUpdateData data) {
if (data.opCode == LocationRequestUpdateData.REQUEST_UPDATES) {
requestLocationUpdates(new LocationRequestHelper(context, hasFineLocationPermission(), hasCoarseLocationPermission(), null, data));
if (data.fusedLocationProviderCallback != null) {
try {
data.fusedLocationProviderCallback.onFusedLocationProviderResult(FusedLocationProviderResult.SUCCESS);
} catch (RemoteException ignored) {
}
}
} else if (data.opCode == LocationRequestUpdateData.REMOVE_UPDATES) {
for (int i = 0; i < currentRequests.size(); i++) {
if (currentRequests.get(i).respondsTo(data.listener)

View File

@ -27,7 +27,11 @@ import com.google.android.gms.location.ILocationCallback;
import com.google.android.gms.location.ILocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationResult;
import com.google.android.gms.location.internal.IFusedLocationProviderCallback;
import com.google.android.gms.location.internal.LocationRequestUpdateData;
import com.google.android.gms.location.internal.FusedLocationProviderResult;
import com.google.android.gms.common.api.Status;
import java.util.Arrays;
import java.util.Collections;