本文整理匯總了Java中com.google.android.gms.common.GooglePlayServicesClient類的典型用法代碼示例。如果您正苦於以下問題:Java GooglePlayServicesClient類的具體用法?Java GooglePlayServicesClient怎麽用?Java GooglePlayServicesClient使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GooglePlayServicesClient類屬於com.google.android.gms.common包,在下文中一共展示了GooglePlayServicesClient類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setMockLocation
import com.google.android.gms.common.GooglePlayServicesClient; //導入依賴的package包/類
public void setMockLocation(final LatLng location) throws InterruptedException {
client = new LocationClient(this, new GooglePlayServicesClient.ConnectionCallbacks() {
@Override
public void onConnected(Bundle bundle) {
client.setMockMode(true);
Location newLocation = new Location("flp");
newLocation.setLatitude(location.latitude);
newLocation.setLongitude(location.longitude);
newLocation.setAccuracy(3f);
client.setMockLocation(newLocation);
}
@Override
public void onDisconnected() {
}
}, new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
Toast.makeText(MainActivity.this, "Make sure that Mock Location is enabled in developer settings", Toast.LENGTH_SHORT).show();
}
});
client.connect();
}
示例2: Builder
import com.google.android.gms.common.GooglePlayServicesClient; //導入依賴的package包/類
public Builder(Context paramContext, GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
this.mContext = paramContext;
this.Dz = paramConnectionCallbacks;
this.jE = paramOnConnectionFailedListener;
this.DA = new hv(this.mContext);
}
示例3: Builder
import com.google.android.gms.common.GooglePlayServicesClient; //導入依賴的package包/類
public Builder(Context paramContext, GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
this.mContext = paramContext;
this.tx = paramContext.getPackageName();
this.jD = paramConnectionCallbacks;
this.jE = paramOnConnectionFailedListener;
}
示例4: Builder
import com.google.android.gms.common.GooglePlayServicesClient; //導入依賴的package包/類
public Builder(Context paramContext, GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
this.mContext = paramContext;
this.jD = paramConnectionCallbacks;
this.jE = paramOnConnectionFailedListener;
this.jF = jC;
this.jG = "<<default account>>";
}
示例5: getWeatherFromPlayServices
import com.google.android.gms.common.GooglePlayServicesClient; //導入依賴的package包/類
/**
* Called when the user has their location set to automatic.
* This will connect to google play services to get the last location
* from their device.
*/
private void getWeatherFromPlayServices() {
mPlayServicesLocationClient = new LocationClient(getContext(), new GooglePlayServicesClient.ConnectionCallbacks() {
@Override
public void onConnected(Bundle bundle) {
// client has connected, so lets get the location
final Location lastLocation = mPlayServicesLocationClient.getLastLocation();
// disconnect the client to end networking
mPlayServicesLocationClient.disconnect();
mPlayServicesLocationClient = null;
// set the weather data from that location
new Thread(new Runnable() {
@Override
public void run() {
setWeaterDataFromGeo(lastLocation);
}
}).start();
}
@Override
public void onDisconnected() {
// client has disconnected
mPlayServicesLocationClient = null;
}
}, new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
// something went wrong, may expand here later
mPlayServicesLocationClient = null;
}
});
// get the connection
mPlayServicesLocationClient.connect();
}
示例6: FusedPositionManager
import com.google.android.gms.common.GooglePlayServicesClient; //導入依賴的package包/類
public FusedPositionManager(Context context, final GPSCConnectionHandler gPSCConnectionHandler) {
intentService = new Intent(context, FusedLocationService.class);
pendingIntent = PendingIntent.getService(context, 1, intentService, 0);
int resp = GooglePlayServicesUtil.isGooglePlayServicesAvailable(context);
if (resp == ConnectionResult.SUCCESS) {
locationclient = new LocationClient(context, new GooglePlayServicesClient.ConnectionCallbacks() {
@Override
public void onConnected(Bundle bundle) {
gPSCConnectionHandler.onConnected(bundle);
}
@Override
public void onDisconnected() {
gPSCConnectionHandler.onDisconnected();
}
}, new GooglePlayServicesClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
gPSCConnectionHandler.onConnectionFailed(connectionResult);
}
}
);
locationclient.connect();
} else {
Log.e("error","googleplayservices is not available");
}
}
示例7: LocationTracking
import com.google.android.gms.common.GooglePlayServicesClient; //導入依賴的package包/類
/**
* Subscribes for location updates
*
* The updates will be received with the interval INTERVAL_UPDATE (ms)
* @param context current context
* @param locationListener Callback
*/
public LocationTracking(final Context context, final LocationListener locationListener) {
locationclient = new LocationClient(context, new GooglePlayServicesClient.ConnectionCallbacks() {
@Override
public void onConnected(Bundle bundle) {
Toast.makeText(context, "Connected to GPS!!", Toast.LENGTH_LONG)
.show();
locationclient.requestLocationUpdates(
LocationRequest.create().setInterval(INTERVAL_UPDATE)
.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY),
locationListener);
}
@Override
public void onDisconnected() {
Toast.makeText(context, "Disconnected from GPS!!", Toast.LENGTH_LONG)
.show();
}
}, new GooglePlayServicesClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
Toast.makeText(context, "Failed to connect to GPS!!", Toast.LENGTH_LONG)
.show();
}
}
);
locationclient.connect();
LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
if (!locationManager.isProviderEnabled(android.location.LocationManager.GPS_PROVIDER)) {
Toast.makeText(context,
"Please enable gps to get a more accurate location tracking", Toast.LENGTH_LONG)
.show();
Intent myIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(myIntent);
}
}
示例8: ForwardConnectionCallbacks
import com.google.android.gms.common.GooglePlayServicesClient; //導入依賴的package包/類
public ForwardConnectionCallbacks(GooglePlayServicesClient.ConnectionCallbacks callbacks) {
this.callbacks = callbacks;
}
示例9: ForwardConnectionFailedListener
import com.google.android.gms.common.GooglePlayServicesClient; //導入依賴的package包/類
public ForwardConnectionFailedListener(
GooglePlayServicesClient.OnConnectionFailedListener listener) {
this.listener = listener;
}
示例10: isConnectionCallbacksRegistered
import com.google.android.gms.common.GooglePlayServicesClient; //導入依賴的package包/類
@Deprecated
public boolean isConnectionCallbacksRegistered(GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks)
{
return this.Du.isConnectionCallbacksRegistered(paramConnectionCallbacks);
}
示例11: isConnectionFailedListenerRegistered
import com.google.android.gms.common.GooglePlayServicesClient; //導入依賴的package包/類
@Deprecated
public boolean isConnectionFailedListenerRegistered(GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
return this.Du.isConnectionFailedListenerRegistered(paramOnConnectionFailedListener);
}
示例12: registerConnectionCallbacks
import com.google.android.gms.common.GooglePlayServicesClient; //導入依賴的package包/類
@Deprecated
public void registerConnectionCallbacks(GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks)
{
this.Du.registerConnectionCallbacks(paramConnectionCallbacks);
}
示例13: registerConnectionFailedListener
import com.google.android.gms.common.GooglePlayServicesClient; //導入依賴的package包/類
@Deprecated
public void registerConnectionFailedListener(GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
this.Du.registerConnectionFailedListener(paramOnConnectionFailedListener);
}
示例14: unregisterConnectionCallbacks
import com.google.android.gms.common.GooglePlayServicesClient; //導入依賴的package包/類
@Deprecated
public void unregisterConnectionCallbacks(GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks)
{
this.Du.unregisterConnectionCallbacks(paramConnectionCallbacks);
}
示例15: unregisterConnectionFailedListener
import com.google.android.gms.common.GooglePlayServicesClient; //導入依賴的package包/類
@Deprecated
public void unregisterConnectionFailedListener(GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
this.Du.unregisterConnectionFailedListener(paramOnConnectionFailedListener);
}