VancedMicroG/src/com/google/android/gms/location/LocationClient.java

80 lines
3.1 KiB
Java
Raw Normal View History

2015-01-15 19:11:31 +00:00
package com.google.android.gms.location;
2015-01-19 00:46:08 +00:00
import android.app.PendingIntent;
2015-01-15 19:11:31 +00:00
import android.content.Context;
2015-01-19 00:46:08 +00:00
import android.location.Location;
import android.os.Looper;
2015-01-15 19:11:31 +00:00
import com.google.android.gms.common.api.GoogleApiClient;
2015-01-19 00:46:08 +00:00
import com.google.android.gms.common.api.PendingResult;
2015-01-15 19:11:31 +00:00
import org.microg.gms.common.ForwardConnectionCallbacks;
import org.microg.gms.common.ForwardConnectionFailedListener;
2015-01-19 00:46:08 +00:00
import org.microg.gms.common.api.AbstractPlayServicesClient;
2015-01-15 19:11:31 +00:00
2015-01-25 23:43:41 +00:00
/**
* This class is deprecated as of play services 6.5, do not use it in production systems,
* it's just a forwarder for the {@link FusedLocationProviderApi}.
*/
2015-01-15 19:11:31 +00:00
@Deprecated
2015-01-19 00:46:08 +00:00
public class LocationClient extends AbstractPlayServicesClient {
public static final String KEY_LOCATION_CHANGED = "com.google.android.location.LOCATION";
public LocationClient(Context context, ConnectionCallbacks callbacks,
OnConnectionFailedListener connectionFailedListener) {
2015-01-19 00:46:08 +00:00
super(new GoogleApiClient.Builder(context)
2015-01-15 19:11:31 +00:00
.addApi(LocationServices.API)
.addConnectionCallbacks(new ForwardConnectionCallbacks(callbacks))
.addOnConnectionFailedListener(new ForwardConnectionFailedListener
(connectionFailedListener))
2015-01-19 00:46:08 +00:00
.build());
2015-01-15 19:11:31 +00:00
}
2015-01-19 00:46:08 +00:00
public Location getLastLocation() {
2015-02-06 12:00:31 +00:00
assertConnected();
2015-01-19 00:46:08 +00:00
return LocationServices.FusedLocationApi.getLastLocation(googleApiClient);
2015-01-15 19:11:31 +00:00
}
public PendingResult requestLocationUpdates(LocationRequest request,
LocationListener listener) {
2015-02-06 12:00:31 +00:00
assertConnected();
return LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, request,
listener);
2015-01-15 19:11:31 +00:00
}
public PendingResult requestLocationUpdates(LocationRequest request,
LocationListener listener, Looper looper) {
2015-02-06 12:00:31 +00:00
assertConnected();
return LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, request,
listener, looper);
2015-01-15 19:11:31 +00:00
}
public PendingResult requestLocationUpdates(LocationRequest request,
PendingIntent callbackIntent) {
2015-02-06 12:00:31 +00:00
assertConnected();
return LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, request,
callbackIntent);
2015-01-15 19:11:31 +00:00
}
2015-01-19 00:46:08 +00:00
public PendingResult removeLocationUpdates(LocationListener listener) {
2015-02-06 12:00:31 +00:00
assertConnected();
2015-01-19 00:46:08 +00:00
return LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient, listener);
2015-01-15 19:11:31 +00:00
}
2015-01-19 00:46:08 +00:00
public PendingResult removeLocationUpdates(PendingIntent callbackIntent) {
2015-02-06 12:00:31 +00:00
assertConnected();
return LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient,
callbackIntent);
2015-01-15 19:11:31 +00:00
}
2015-01-19 00:46:08 +00:00
public PendingResult setMockMode(boolean isMockMode) {
2015-02-06 12:00:31 +00:00
assertConnected();
2015-01-19 00:46:08 +00:00
return LocationServices.FusedLocationApi.setMockMode(googleApiClient, isMockMode);
2015-01-15 19:11:31 +00:00
}
2015-01-19 00:46:08 +00:00
public PendingResult setMockLocation(Location mockLocation) {
2015-02-06 12:00:31 +00:00
assertConnected();
2015-01-19 00:46:08 +00:00
return LocationServices.FusedLocationApi.setMockLocation(googleApiClient, mockLocation);
2015-01-15 19:11:31 +00:00
}
}