Java 类com.google.android.gms.common.GooglePlayServicesClient 实例源码

项目:MockLocation    文件:MainActivity.java   
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();
}
项目:QuizUpWinner    文件:PlusClient.java   
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);
}
项目:QuizUpWinner    文件:GamesClient.java   
public Builder(Context paramContext, GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
  this.mContext = paramContext;
  this.tx = paramContext.getPackageName();
  this.jD = paramConnectionCallbacks;
  this.jE = paramOnConnectionFailedListener;
}
项目:QuizUpWinner    文件:AppStateClient.java   
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>>";
}
项目:Blur-Extension-Examples    文件:WeatherCard.java   
/**
 * 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();
}
项目:gpsc-location    文件:FusedPositionManager.java   
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");
        }
    }
项目:ADSB-Sniffer    文件:LocationTracking.java   
/**
 * 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);
    }
}
项目:android_external_GmsLib    文件:ForwardConnectionCallbacks.java   
public ForwardConnectionCallbacks(GooglePlayServicesClient.ConnectionCallbacks callbacks) {
    this.callbacks = callbacks;
}
项目:android_external_GmsLib    文件:ForwardConnectionFailedListener.java   
public ForwardConnectionFailedListener(
        GooglePlayServicesClient.OnConnectionFailedListener listener) {
    this.listener = listener;
}
项目:QuizUpWinner    文件:PlusClient.java   
@Deprecated
public boolean isConnectionCallbacksRegistered(GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks)
{
  return this.Du.isConnectionCallbacksRegistered(paramConnectionCallbacks);
}
项目:QuizUpWinner    文件:PlusClient.java   
@Deprecated
public boolean isConnectionFailedListenerRegistered(GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
  return this.Du.isConnectionFailedListenerRegistered(paramOnConnectionFailedListener);
}
项目:QuizUpWinner    文件:PlusClient.java   
@Deprecated
public void registerConnectionCallbacks(GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks)
{
  this.Du.registerConnectionCallbacks(paramConnectionCallbacks);
}
项目:QuizUpWinner    文件:PlusClient.java   
@Deprecated
public void registerConnectionFailedListener(GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
  this.Du.registerConnectionFailedListener(paramOnConnectionFailedListener);
}
项目:QuizUpWinner    文件:PlusClient.java   
@Deprecated
public void unregisterConnectionCallbacks(GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks)
{
  this.Du.unregisterConnectionCallbacks(paramConnectionCallbacks);
}
项目:QuizUpWinner    文件:PlusClient.java   
@Deprecated
public void unregisterConnectionFailedListener(GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
  this.Du.unregisterConnectionFailedListener(paramOnConnectionFailedListener);
}
项目:QuizUpWinner    文件:GamesClient.java   
private GamesClient(Context paramContext, String paramString1, String paramString2, GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener, String[] paramArrayOfString, int paramInt1, View paramView, boolean paramBoolean, int paramInt2)
{
  this.te = new fl(paramContext, paramString1, paramString2, paramConnectionCallbacks, paramOnConnectionFailedListener, paramArrayOfString, paramInt1, paramView, false, paramBoolean, paramInt2);
}
项目:QuizUpWinner    文件:GamesClient.java   
@Deprecated
public final boolean isConnectionCallbacksRegistered(GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks)
{
  return this.te.isConnectionCallbacksRegistered(paramConnectionCallbacks);
}
项目:QuizUpWinner    文件:GamesClient.java   
@Deprecated
public final boolean isConnectionFailedListenerRegistered(GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
  return this.te.isConnectionFailedListenerRegistered(paramOnConnectionFailedListener);
}
项目:QuizUpWinner    文件:GamesClient.java   
@Deprecated
public final void registerConnectionCallbacks(GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks)
{
  this.te.registerConnectionCallbacks(paramConnectionCallbacks);
}
项目:QuizUpWinner    文件:GamesClient.java   
@Deprecated
public final void registerConnectionFailedListener(GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
  this.te.registerConnectionFailedListener(paramOnConnectionFailedListener);
}
项目:QuizUpWinner    文件:GamesClient.java   
@Deprecated
public final void unregisterConnectionCallbacks(GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks)
{
  this.te.unregisterConnectionCallbacks(paramConnectionCallbacks);
}
项目:QuizUpWinner    文件:GamesClient.java   
@Deprecated
public final void unregisterConnectionFailedListener(GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
  this.te.unregisterConnectionFailedListener(paramOnConnectionFailedListener);
}
项目:QuizUpWinner    文件:dw.java   
protected dw(Context paramContext, GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener, String[] paramArrayOfString)
{
  this(paramContext, new c(paramConnectionCallbacks), new g(paramOnConnectionFailedListener), paramArrayOfString);
}
项目:QuizUpWinner    文件:dw.java   
public boolean isConnectionCallbacksRegistered(GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks)
{
  return this.ne.isConnectionCallbacksRegistered(new c(paramConnectionCallbacks));
}
项目:QuizUpWinner    文件:dw.java   
public boolean isConnectionFailedListenerRegistered(GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
  return this.ne.isConnectionFailedListenerRegistered(paramOnConnectionFailedListener);
}
项目:QuizUpWinner    文件:dw.java   
public void registerConnectionCallbacks(GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks)
{
  this.ne.registerConnectionCallbacks(new c(paramConnectionCallbacks));
}
项目:QuizUpWinner    文件:dw.java   
public void registerConnectionFailedListener(GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
  this.ne.registerConnectionFailedListener(paramOnConnectionFailedListener);
}
项目:QuizUpWinner    文件:dw.java   
public void unregisterConnectionCallbacks(GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks)
{
  this.ne.unregisterConnectionCallbacks(new c(paramConnectionCallbacks));
}
项目:QuizUpWinner    文件:dw.java   
public void unregisterConnectionFailedListener(GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
  this.ne.unregisterConnectionFailedListener(paramOnConnectionFailedListener);
}
项目:QuizUpWinner    文件:dw.java   
public c(GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks)
{
  this.pn = paramConnectionCallbacks;
}
项目:QuizUpWinner    文件:dw.java   
public g(GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
  this.pp = paramOnConnectionFailedListener;
}
项目:QuizUpWinner    文件:hs.java   
@Deprecated
public hs(Context paramContext, GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener, hu paramhu)
{
  this(paramContext, new dw.c(paramConnectionCallbacks), new dw.g(paramOnConnectionFailedListener), paramhu);
}
项目:QuizUpWinner    文件:ActivityRecognitionClient.java   
public ActivityRecognitionClient(Context paramContext, GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
  this.xl = new gn(paramContext, paramConnectionCallbacks, paramOnConnectionFailedListener, "activity_recognition");
}
项目:QuizUpWinner    文件:ActivityRecognitionClient.java   
public boolean isConnectionCallbacksRegistered(GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks)
{
  return this.xl.isConnectionCallbacksRegistered(paramConnectionCallbacks);
}
项目:QuizUpWinner    文件:ActivityRecognitionClient.java   
public boolean isConnectionFailedListenerRegistered(GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
  return this.xl.isConnectionFailedListenerRegistered(paramOnConnectionFailedListener);
}
项目:QuizUpWinner    文件:ActivityRecognitionClient.java   
public void registerConnectionCallbacks(GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks)
{
  this.xl.registerConnectionCallbacks(paramConnectionCallbacks);
}
项目:QuizUpWinner    文件:ActivityRecognitionClient.java   
public void registerConnectionFailedListener(GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
  this.xl.registerConnectionFailedListener(paramOnConnectionFailedListener);
}
项目:QuizUpWinner    文件:ActivityRecognitionClient.java   
public void unregisterConnectionCallbacks(GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks)
{
  this.xl.unregisterConnectionCallbacks(paramConnectionCallbacks);
}
项目:QuizUpWinner    文件:ActivityRecognitionClient.java   
public void unregisterConnectionFailedListener(GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
  this.xl.unregisterConnectionFailedListener(paramOnConnectionFailedListener);
}
项目:QuizUpWinner    文件:LocationClient.java   
public LocationClient(Context paramContext, GooglePlayServicesClient.ConnectionCallbacks paramConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener paramOnConnectionFailedListener)
{
  this.xl = new gn(paramContext, paramConnectionCallbacks, paramOnConnectionFailedListener, "location");
}