public final void onAddGeofencesResult(Status status) { WLog.d(SynchronizedLocationClient.access$200(), "onAddGeofencesResult()"); switch (status.getStatusCode()) { default: SynchronizedLocationClient.access$400(SynchronizedLocationClient.this, new LocationClientException(String.format("addGeofences failed - unknown error: %d", new Object[] { Integer.valueOf(status.getStatusCode()) }))); return; case 0: // '\0' SynchronizedLocationClient.access$300(SynchronizedLocationClient.this); return; case 1001: SynchronizedLocationClient.access$400(SynchronizedLocationClient.this, new LocationClientException("addGeofences failed: GEOFENCE_TOO_MANY_GEOFENCES")); return; case 1002: SynchronizedLocationClient.access$400(SynchronizedLocationClient.this, new LocationClientException("addGeofences failed: GEOFENCE_TOO_MANY_PENDING_INTENTS")); return; case 1000: SynchronizedLocationClient.access$400(SynchronizedLocationClient.this, new LocationClientException("addGeofences failed: GEOFENCE_NOT_AVAILABLE")); return; case 1: // '\001' SynchronizedLocationClient.access$400(SynchronizedLocationClient.this, new LocationClientException("addGeofences failed: ERROR")); return; } }
/** * Submits an autocomplete query to the Places Geo Data Autocomplete API. Results are returned as * frozen AutocompletePrediction objects, ready to be cached. objects to store the Place ID and * description that the API returns. Returns an empty list if no results were found. Returns null * if the API client is not available or the query did not complete successfully. This method MUST * be called off the main UI thread, as it will block until data is returned from the API, which * may include a network request. * * @param constraint Autocomplete query string * @return Results from the autocomplete API or null if the query was not successful. * @see Places#GEO_DATA_API#getAutocomplete(CharSequence) * @see AutocompletePrediction#freeze() */ private ArrayList<AutocompletePrediction> getAutocomplete(CharSequence constraint) { if (mGoogleApiClient.isConnected()) { Log.i(TAG, "Starting autocomplete query for: " + constraint); // Submit the query to the autocomplete API and retrieve a PendingResult that will // contain the results when the query completes. PendingResult<AutocompletePredictionBuffer> results = Places.GeoDataApi.getAutocompletePredictions( mGoogleApiClient, constraint.toString(), mBounds, mPlaceFilter); // This method should have been called off the main UI thread. Block and wait for at most 60s // for a result from the API. AutocompletePredictionBuffer autocompletePredictions = results.await(60, TimeUnit.SECONDS); // Confirm that the query completed successfully, otherwise return null final Status status = autocompletePredictions.getStatus(); if (!status.isSuccess()) { Toast.makeText( getContext(), "Error contacting API: " + status.toString(), Toast.LENGTH_SHORT) .show(); Log.e(TAG, "Error getting autocomplete prediction API call: " + status.toString()); autocompletePredictions.release(); return null; } Log.i( TAG, "Query completed. Received " + autocompletePredictions.getCount() + " predictions."); // Freeze the results immutable representation that can be stored safely. return DataBufferUtils.freezeAndClose(autocompletePredictions); } Log.e(TAG, "Google API client is not connected for autocomplete query."); return null; }
@Override public void onResult(ApplicationConnectionResult result) { Status status = result.getStatus(); if (status.isSuccess()) { try { ApplicationMetadata metadata = result.getApplicationMetadata(); ChromecastSession.this.sessionId = result.getSessionId(); ChromecastSession.this.displayName = metadata.getName(); ChromecastSession.this.appImages = metadata.getImages(); ChromecastSession.this.joinSessionCallback.onSuccess(ChromecastSession.this); connectRemoteMediaPlayer(); ChromecastSession.this.isConnected = true; } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } else { ChromecastSession.this.joinSessionCallback.onError(status.toString()); ChromecastSession.this.isConnected = false; } }
public void onResult(Status status) { if (status.isSuccess()) { Toast.makeText(getApplicationContext(), Constantes.geofences_added, Toast.LENGTH_SHORT) .show(); } else { String errorMessage = getErrorString(this, status.getStatusCode()); Toast.makeText(getApplicationContext(), errorMessage, Toast.LENGTH_LONG).show(); } }
public void onResult(Status status) { if (status.isSuccess()) { SharedPreferences.Editor editor = mSharedPreferences.edit(); editor.putBoolean(Constants.GEOFENCES_ADDED_KEY, mGeofencesAdded); editor.apply(); } else { String errorMessage = GeofenceErrorMessages.getErrorString(this, status.getStatusCode()); Log.e(TAG, errorMessage); } }
@Override public void onResult(Status result) { if (!result.isSuccess()) { Log.d( "", "Failed to send message. statusCode: " + result.getStatusCode() + " message: " + mMessage); } }
public void onResult(@NonNull Status status) { Log.d("GEO", "Geofences onResult" + status.toString()); if (status.isSuccess()) { mGoogleApiClient.disconnect(); stopSelf(); } else { String text = "Error while geofence: " + status.getStatusMessage(); Log.e("GEO", text); Toast.makeText(GeofencingService.this, text, Toast.LENGTH_SHORT).show(); } }
private ArrayList<PlaceAutocomplete> getAutocomplete(CharSequence constraint) { if (mGoogleApiClient.isConnected()) { Log.i(TAG, "Starting autocomplete query for: " + constraint); // Submit the query to the autocomplete API and retrieve a PendingResult that will // contain the results when the query completes. PendingResult<AutocompletePredictionBuffer> results = Places.GeoDataApi.getAutocompletePredictions( mGoogleApiClient, constraint.toString(), null, mPlaceFilter); // This method should have been called off the main UI thread. Block and wait for at most 60s // for a result from the API. AutocompletePredictionBuffer autocompletePredictions = results.await(60, TimeUnit.SECONDS); // Confirm that the query completed successfully, otherwise return null final Status status = autocompletePredictions.getStatus(); if (!status.isSuccess()) { Toast.makeText( getContext(), "Error contacting Google Places: " + status.toString(), Toast.LENGTH_SHORT) .show(); Log.e( TAG, "Error getting autocomplete prediction API call: " + status.getStatusMessage() + status.getStatus().getStatusMessage()); autocompletePredictions.release(); return null; } Log.i( TAG, "Query completed. Received " + autocompletePredictions.getCount() + " predictions."); // Copy the results into our own data structure, because we can't hold onto the buffer. // AutocompletePrediction objects encapsulate the API response (place ID and description). Iterator<AutocompletePrediction> iterator = autocompletePredictions.iterator(); ArrayList resultList = new ArrayList<>(autocompletePredictions.getCount()); while (iterator.hasNext()) { AutocompletePrediction prediction = iterator.next(); // Get the details of this prediction and copy it into a new PlaceAutocomplete object. resultList.add(new PlaceAutocomplete(prediction.getPlaceId(), prediction.getDescription())); } // Release the buffer now that all data has been copied. autocompletePredictions.release(); return resultList; } Log.e(TAG, "Google API client is not connected for autocomplete query."); return null; }
/** * Runs when the result of calling addGeofences() and removeGeofences() becomes available. Either * method can complete successfully or with an error. * * <p>Since this activity implements the {@link ResultCallback} interface, we are required to * define this method. * * @param status The Status returned through a PendingIntent when addGeofences() or * removeGeofences() get called. */ public void onResult(Status status) { if (status.isSuccess()) { // Update state and save in shared preferences. mGeofencesAdded = !mGeofencesAdded; SharedPreferences.Editor editor = mSharedPreferences.edit(); editor.putBoolean(Constants.GEOFENCES_ADDED_KEY, mGeofencesAdded); editor.commit(); // Update the UI. Adding geofences enables the Remove Geofences button, and removing // geofences enables the Add Geofences button. setButtonsEnabledState(); Toast.makeText( this, getString(mGeofencesAdded ? R.string.geofences_added : R.string.geofences_removed), Toast.LENGTH_SHORT) .show(); } else { // Get the status code for the error and log it using a user-friendly message. String errorMessage = GeofenceErrorMessages.getErrorString(this, status.getStatusCode()); Log.e(TAG, errorMessage); } }
/** * This method receives the connection error details and tries to execute the error resolution * provided by the object itself. * * <p>The error resolution opens a Dialog that informs the user what to do to resolve the issue. * Then the operation result is received on onActivityResult */ private void handleConnectionFailureError(Parcelable errorDetails) { // TODO: change errorDetails to avoid the usage of the instanceof operator. Bad smells. if (errorDetails != null) { if (errorDetails instanceof ConnectionResult) { ConnectionResult result = (ConnectionResult) errorDetails; try { result.startResolutionForResult(this, REQUEST_RESOLVE_GOOGLE_SERVICES_ERROR); isResolvingError = true; } catch (IntentSender.SendIntentException e) { e.printStackTrace(); postEventAndFinish(new OnStrategyErrorNotSolved()); } } else if (errorDetails instanceof Status) { Status status = (Status) errorDetails; try { status.startResolutionForResult(this, REQUEST_RESOLVE_GOOGLE_SERVICES_ERROR); isResolvingError = true; } catch (IntentSender.SendIntentException e) { e.printStackTrace(); postEventAndFinish(new OnStrategyErrorNotSolved()); } } } }
public void a(Status status) throws RemoteException { Parcel parcel = Parcel.obtain(); parcel.writeInterfaceToken("com.google.android.gms.appdatasearch.internal.ILightweightAppDataSearchCallbacks"); if (status == null) { break MISSING_BLOCK_LABEL_44; } parcel.writeInt(1); status.writeToParcel(parcel, 0); _L1: ko.transact(1, parcel, null, 1); parcel.recycle(); return; parcel.writeInt(0); goto _L1
public final void onStatusReceived(Status status) throws RemoteException { Parcel parcel = Parcel.obtain(); parcel.writeInterfaceToken("com.google.android.gms.nearby.sharing.internal.INearbySharingCallback"); if (status == null) { break MISSING_BLOCK_LABEL_44; } parcel.writeInt(1); status.writeToParcel(parcel, 0); _L1: mRemote.transact(1, parcel, null, 1); parcel.recycle(); return; parcel.writeInt(0); goto _L1
public void o(Status status) { Parcel parcel; Parcel parcel1; parcel = Parcel.obtain(); parcel1 = Parcel.obtain(); parcel.writeInterfaceToken("com.google.android.gms.drive.realtime.internal.IStringCallback"); if (status == null) { break MISSING_BLOCK_LABEL_56; } parcel.writeInt(1); status.writeToParcel(parcel, 0); _L1: kq.transact(2, parcel, parcel1, 0); parcel1.readException(); parcel1.recycle(); parcel.recycle(); return; parcel.writeInt(0); goto _L1
private boolean b(SessionStopResult sessionstopresult) { return CM.equals(sessionstopresult.CM) && n.equal(Ul, sessionstopresult.Ul); }