コード例 #1
0
ファイル: d.java プロジェクト: pankajk87/CompSecurity
 public void a(GoogleApiClient googleapiclient, GoogleApiClient.OnConnectionFailedListener onconnectionfailedlistener)
 {
     Et = googleapiclient;
     Et.registerConnectionCallbacks(this);
     DN = onconnectionfailedlistener;
     Et.registerConnectionCallbacks(this);
     Et.registerConnectionFailedListener(this);
 }
コード例 #2
0
  @AutoFactory
  public LocationProvider(
      @Provided GoogleApiAvailability googleApiAvailability,
      @Provided GoogleApiClient googleApiClient,
      @Provided FusedLocationProviderApi fusedLocationProviderApi,
      @Provided LocationManager locationManager,
      @Provided SensorManager sensorManager,
      @Provided Display displayManager,
      Context context,
      LocationCallback locationCallback) {
    this.mGoogleApiAvailability = googleApiAvailability;
    this.mGoogleApiClient = googleApiClient;
    this.mFusedLocationProviderApi = fusedLocationProviderApi;
    this.mLocationManager = locationManager;
    this.mContext = context;
    this.mLocationCallback = locationCallback;
    this.mSensorManager = sensorManager;
    this.mDisplay = displayManager;
    mLocationRequest =
        LocationRequest.create()
            .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
            .setInterval(INTERVAL_IN_MS)
            .setFastestInterval(FASTEST_INTERVAL_IN_MS);
    mNetworkLocationListener = createLocationListener();
    mGpsLocationListener = createLocationListener();

    determineIfUsingGms();
    if (isUsingGms()) {
      mGoogleApiClient.registerConnectionCallbacks(this);
      mGoogleApiClient.registerConnectionFailedListener(this);
    }
  }
コード例 #3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_signin);

    // Button listeners
    findViewById(R.id.sign_in_button).setOnClickListener(this);

    mGoogleApiClient = GoogleApiClientHolder.getApiClient(this);

    mGoogleApiClient.registerConnectionFailedListener(this);
    mGoogleApiClient.registerConnectionCallbacks(this);
  }
コード例 #4
0
  protected GoogleApiClient getGoogleApiClient() {
    if (mGoogleApiClient == null) {
      mGoogleApiClient =
          new GoogleApiClient.Builder(getActivity())
              .addApi(
                  Wallet.API,
                  new Wallet.WalletOptions.Builder()
                      .setEnvironment(AndroidPay.getEnvironment(getConfiguration().getAndroidPay()))
                      .setTheme(WalletConstants.THEME_LIGHT)
                      .build())
              .build();
    }

    if (!mGoogleApiClient.isConnected() && !mGoogleApiClient.isConnecting()) {
      mGoogleApiClient.registerConnectionCallbacks(
          new ConnectionCallbacks() {
            @Override
            public void onConnected(Bundle bundle) {}

            @Override
            public void onConnectionSuspended(int i) {
              postCallback(new GoogleApiClientException("Connection suspended: " + i));
            }
          });

      mGoogleApiClient.registerConnectionFailedListener(
          new OnConnectionFailedListener() {
            @Override
            public void onConnectionFailed(ConnectionResult connectionResult) {
              postCallback(
                  new GoogleApiClientException(
                      "Connection failed: " + connectionResult.getErrorCode()));
            }
          });

      mGoogleApiClient.connect();
    }

    return mGoogleApiClient;
  }