@Override protected void onStart() { super.onStart(); if (!isResolvingPlayServicesError && playServices!=null) { playServices.connect(); } }
@Override protected void onStart() { super.onStart(); if (!isResolvingPlayServicesError && playServices!=null) { playServices.connect(); } }
@Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { isInPermission=false; if (requestCode==REQUEST_PERMISSION) { if (hasAllPermissions(getDesiredPermissions())) { initPlayServices(); playServices.connect(); } else { handlePermissionDenied(); } } }
@Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { isInPermission=false; if (requestCode==REQUEST_PERMISSION) { if (hasAllPermissions(getDesiredPermissions())) { initPlayServices(); playServices.connect(); } else { handlePermissionDenied(); } } }
@Override public void onConnectionFailed(ConnectionResult result) { if (!isResolvingPlayServicesError) { if (result.hasResolution()) { try { isResolvingPlayServicesError=true; result.startResolutionForResult(this, REQUEST_RESOLUTION); } catch (IntentSender.SendIntentException e) { playServices.connect(); } } else { ErrorDialogFragment.newInstance(result.getErrorCode()) .show(getFragmentManager(), TAG_ERROR_DIALOG_FRAGMENT); isResolvingPlayServicesError=true; } } }
@Override public void onConnectionFailed(ConnectionResult result) { if (!isResolvingPlayServicesError) { if (result.hasResolution()) { try { isResolvingPlayServicesError=true; result.startResolutionForResult(this, REQUEST_RESOLUTION); } catch (IntentSender.SendIntentException e) { playServices.connect(); } } else { ErrorDialogFragment.newInstance(result.getErrorCode()) .show(getFragmentManager(), TAG_ERROR_DIALOG_FRAGMENT); isResolvingPlayServicesError=true; } } }
@Override protected void onStart() { super.onStart(); mGoogleApiClient.connect(); }
void startLocationUpdates() { googleApiClient.connect(); if (connected && locationRequest != null) { isStarted = true; LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, locationRequest, locationListener); } }
@Override public void onStart(){ super.onStart(); client.connect(); AppIndex.AppIndexApi.start(client, getIndexApiAction()); } @Override
mApiClient.connect();
public LocationRepository(GoogleApiClient mGoogleApiClient, Context context) { this.mGoogleApiClient = mGoogleApiClient; this.context = context; this.mGoogleApiClient.connect(); }
@Override protected void onStart() { super.onStart(); mGoogleApiClient.connect(); }
@Override public void onResume() { super.onResume(); mGoogleApiClient.connect(); }
@Override public void onStart() { super.onStart(); mGoogleApiClient.connect(); }
/** * Connects the LocationClient. * <p> * To avoid errors only tries if is not pending for another connection * request or is disconnected. */ public void connectLocationClient() { if (!mGoogleApiClient.isConnected() && !mGoogleApiClient.isConnecting()) { mGoogleApiClient.connect(); } }
@Override public void onStart() { super.onStart(); // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. client.connect(); AppIndex.AppIndexApi.start(client, getIndexApiAction()); }
void connect() { if (mGoogleApiClient.isConnected()) { debugLog("Already connected."); return; } debugLog("Starting connection."); mConnecting = true; mInvitation = null; mTurnBasedMatch = null; mGoogleApiClient.connect(); }
@Override public void onCreate() { super.onCreate(); registerReceiver(mDisconnectActionBroadcastReceiver, new IntentFilter(ACTION_DISCONNECT)); registerReceiver(mIntentBroadcastReceiver, new IntentFilter(ACTION_SEND)); mGoogleApiClient = new GoogleApiClient.Builder(this) .addApi(Wearable.API) .build(); mGoogleApiClient.connect(); }
private void init(final Context context, final GoogleApiClient.ConnectionCallbacks listener) { if (mGoogleApiClient != null) return; mGoogleApiClient = new GoogleApiClient.Builder(context) .addApiIfAvailable(Wearable.API) .addConnectionCallbacks(listener) .build(); mGoogleApiClient.connect(); }
protected <T> void setupBaseObservableError(final BaseObservable<T> baseObservable) { doAnswer(invocation -> { final ObservableEmitter<T> subscriber = ((BaseObservable.ApiClientConnectionCallbacks)invocation.getArguments()[0]).subscriber; doAnswer(invocation1 -> { subscriber.onError(new GoogleAPIConnectionException("Error connecting to GoogleApiClient.", connectionResult)); return null; }).when(apiClient).connect(); return apiClient; }).when(baseObservable).createApiClient(Matchers.any(BaseRx.ApiClientConnectionCallbacks.class)); }