LocationRequest locationRequest = LocationRequest.create() .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); PendingResult<Status> result = LocationServices.FusedLocationApi .requestLocationUpdates( googleApiClient, // your connected GoogleApiClient locationRequest, // a request to receive a new location locationListener); // the listener which will receive updated locations // Callback is asynchronous. Use await() on a background thread or listen for // the ResultCallback result.setResultCallback(new ResultCallback<Status>() { void onResult(Status status) { if (status.isSuccess()) { // Successfully registered } else if (status.hasResolution()) { // Google provides a way to fix the issue status.startResolutionForResult( activity, // your current activity used to receive the result RESULT_CODE); // the result code you'll look for in your // onActivityResult method to retry registering } else { // No recovery. Weep softly or inform the user. Log.e(TAG, "Registering failed: " + status.getStatusMessage()); } } });
@Override public void onResult(Status status) { if (status.isSuccess()) {
@Override protected boolean matchesSafely( Status item ) { return item.isSuccess(); }
Fitness.RecordingApi.subscribe(fitnessClient,DataType.TYPE_STEP_COUNT_DELTA). setResultCallback(new ResultCallback<Status>() { @Override public void onResult(Status arg0) { if(arg0.isSuccess()){ Log.e("Steps Recording","Subcribe"); } } });
LocationServices.GeofencingApi.addGeofences(mGoogleApiClient, mGeofenceList, mGeofenceRequestIntent) .setResultCallback(new ResultCallback<Status>() { @Override public void onResult(Status status) { if (status.isSuccess()) { // Success Log.i(Constants.APPTAG, "success!"); } } });
Auth.GoogleSignInApi.signOut(googleApiClient).setResultCallback( new ResultCallback<Status>() { @Override public void onResult(Status status) { if (status.isSuccess()) { // user logged out successfully } else { // the logout was not sucessful. } });
Fitness.RecordingApi.subscribe(fitnessClient,DataType.TYPE_DISTANCE_DELTA). setResultCallback(new ResultCallback<Status>() { @Override public void onResult(Status arg0) { if(arg0.isSuccess()){ Log.e("Distance Recording","Subcribe"); } } });
/** * Indicates if the status is a success status, meaning "The action was * successfully received, understood, and accepted". * * @return True if the status is a success status. */ public boolean isSuccess() { return isSuccess(getCode()); }
/** * Indicates if the status is a success status, meaning "The action was * successfully received, understood, and accepted". * * @return True if the status is a success status. */ public boolean isSuccess() { return isSuccess(getCode()); }
/** * Indicates if the status is a success status, meaning "The action was * successfully received, understood, and accepted". * * @return True if the status is a success status. */ public boolean isSuccess() { return isSuccess(getCode()); }
@Test(threadPoolSize = 10, invocationCount = 100, timeOut = 5000) public void makeCall() { Request request = new Request(Method.GET, "http://localhost:8111/"); Response response = component.handle(request); Assert.assertTrue(response.getStatus().isSuccess()); Assert.assertEquals("Welcome to the RESTful Mail Server application !", response.getEntityAsText()); }
public RoleResource findRole( String roleId ) throws IOException { Response response = this.sendMessage( Method.GET, null, roleId ); if ( !response.getStatus().isSuccess() ) { return null; } // get the Resource object return this.getResourceFromResponse( response ); }
public RoleResource getRole( String roleId ) throws IOException { Response response = this.sendMessage( Method.GET, null, roleId ); if ( !response.getStatus().isSuccess() ) { Assert.fail( "Could not find role: " + roleId + " got: " + response.getStatus() ); } // get the Resource object return this.getResourceFromResponse( response ); }
/** * Use {@link #getResourceFromText(String)} instead. */ @Deprecated public RepositoryRouteResource getResourceFromResponse(Response response) throws IOException { String responseString = response.getEntity().getText(); LOG.debug("responseText: " + responseString); Assert.assertTrue(response.getStatus() + "\n" + responseString, response.getStatus().isSuccess()); return getResourceFromText(responseString); }
public List<PrivilegeStatusResource> createPrivileges( PrivilegeResource resource ) throws IOException { Response response = this.sendMessage( Method.POST, resource ); if ( !response.getStatus().isSuccess() ) { Assert.fail( "Could not create privilege: " + response.getStatus() ); } // get the Resource object List<PrivilegeStatusResource> statusResources = this.getResourceListFromResponse( response ); SecurityConfigUtil.verifyPrivileges( statusResources ); return statusResources; }
public static void removeAllTarget() throws IOException { List<RepositoryTargetListResource> targets = getList(); for ( RepositoryTargetListResource target : targets ) { Status status = RequestFacade.sendMessage( "service/local/repo_targets/" + target.getId(), Method.DELETE ).getStatus(); Assert.assertTrue( "Failt to delete: " + status.getDescription(), status.isSuccess() ); } }
public List<PrivilegeStatusResource> getList( ) throws IOException { Response response = this.sendMessage( Method.GET, null ); if ( !response.getStatus().isSuccess() ) { Assert.fail( "Could not get Privilege: " + response.getStatus() +"\n" + response.getEntity().getText()); } return this.getResourceListFromResponse( response ); }
public static void removeAllRoutes() throws IOException { List<RepositoryRouteListResource> routes = getList(); for ( RepositoryRouteListResource route : routes ) { Status status = delete( route.getResourceURI() ).getStatus(); Assert.assertTrue( "Unable to delete route: '" + route.getResourceURI() + "', due to: " + status.getDescription(), status.isSuccess() ); } }
public static void removeAllTarget() throws IOException { List<RepositoryTargetListResource> targets = getList(); for (RepositoryTargetListResource target : targets) { Status status = RequestFacade.sendMessage("service/local/repo_targets/" + target.getId(), Method.DELETE).getStatus(); Assert.assertTrue("Failt to delete: " + status.getDescription(), status.isSuccess()); } }
public static void removeAllRoutes() throws IOException { List<RepositoryRouteListResource> routes = getList(); for (RepositoryRouteListResource route : routes) { Status status = delete(route.getResourceURI()).getStatus(); Assert.assertTrue("Unable to delete route: '" + route.getResourceURI() + "', due to: " + status.getDescription(), status.isSuccess()); } }