本文整理了Java中com.google.android.gms.common.api.Status.getStatusMessage()
方法的一些代码示例,展示了Status.getStatusMessage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Status.getStatusMessage()
方法的具体详情如下:
包路径:com.google.android.gms.common.api.Status
类名称:Status
方法名:getStatusMessage
暂无
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onResult(Status status) {
if (status.isSuccess()) {
Toast
.makeText(getActivity(),
R.string.location_req_success_msg,
Toast.LENGTH_LONG)
.show();
} else {
Toast
.makeText(getActivity(), status.getStatusMessage(),
Toast.LENGTH_LONG)
.show();
getActivity().finish();
}
}
});
代码示例来源:origin: org.infobip.mobile.messaging.api/infobip-mobile-messaging-android-sdk
private void logGeofenceStatus(@NonNull Status status, boolean activated) {
if (status.isSuccess()) {
Log.d(TAG, "Geofencing monitoring " + (activated ? "" : "de-") + "activated successfully");
} else {
Log.e(TAG, "Geofencing monitoring " + (activated ? "" : "de-") + "activation failed", new Throwable(status.getStatusMessage()));
}
}
代码示例来源:origin: Aminoid/react-native-activity-recognition
public void onResult(Status status) {
if (status.isSuccess()) {
Log.d(TAG, "Succesfully added or removed activity detection updates");
} else {
Log.e(TAG, "Error adding or removing activity detection updates: " + status.getStatusMessage());
}
}
代码示例来源:origin: googlesamples/android-play-places
/**
* Callback invoked when PlaceAutocompleteFragment encounters an error.
*/
@Override
public void onError(Status status) {
Log.e(TAG, "onError: Status = " + status.toString());
Toast.makeText(this, "Place selection failed: " + status.getStatusMessage(),
Toast.LENGTH_SHORT).show();
}
代码示例来源:origin: jamorham/xDrip-plus
@Override
public void onResult(DataApi.DataItemResult sendMessageResult) {
if (!sendMessageResult.getStatus().isSuccess()) {
UserError.Log.e(TAG, "ERROR: failed to sendblob Status=" + sendMessageResult.getStatus().getStatusMessage());
} else {
UserError.Log.i(TAG, "Sendblob Status=: " + sendMessageResult.getStatus().getStatusMessage());
}
}
});
代码示例来源:origin: NightscoutFoundation/xDrip
@Override
public void onResult(DataApi.DataItemResult sendMessageResult) {
if (!sendMessageResult.getStatus().isSuccess()) {
UserError.Log.e(TAG, "ERROR: failed to sendblob Status=" + sendMessageResult.getStatus().getStatusMessage());
} else {
UserError.Log.i(TAG, "Sendblob Status=: " + sendMessageResult.getStatus().getStatusMessage());
}
}
});
代码示例来源:origin: googlesamples/android-FindMyPhone
@Override
public void onResult(CapabilityApi.GetCapabilityResult result) {
if (result.getStatus().isSuccess()) {
updateFindMeCapability(result.getCapability());
} else {
Log.e(TAG,
"setOrUpdateNotification() Failed to get capabilities, "
+ "status: "
+ result.getStatus().getStatusMessage());
}
}
});
代码示例来源:origin: Michenux/YourAppIdea
public void onResult(Status status) {
if (status.isSuccess()) {
// Successfully registered
} else if (status.hasResolution()) {
// Google provides a way to fix the issue
try {
status.startResolutionForResult(
AroundMeFragment.this.getActivity(), // your current activity used to receive the result
LOCATIONSERVICES_RESOLUTION_RESULCODE); // the result code you'll look for in your onActivityResult method to retry registering
} catch (IntentSender.SendIntentException e) {
Log.e(YourApplication.LOG_TAG, "SimpleMapFragment start resolution failure: ", e);
}
} else {
// No recovery. Weep softly or inform the user.
Log.e(YourApplication.LOG_TAG, "SimpleMapFragment registering failed: " + status.getStatusMessage());
}
}
});
代码示例来源:origin: jamorham/xDrip-plus
@Override
public void onResult(MessageApi.SendMessageResult sendMessageResult) {
if (!sendMessageResult.getStatus().isSuccess()) {
Log.e(TAG, "sendMessagePayload ERROR: failed to send request " + path + " Status=" + sendMessageResult.getStatus().getStatusMessage());
} else {
Log.d(TAG, "sendMessagePayload Sent request " + node.getDisplayName() + " " + path + " Status=: " + sendMessageResult.getStatus().getStatusMessage());
}
}
});
代码示例来源:origin: UdacityAndroidDevScholarship/gis-2k18
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
Log.i(TAG, "onActivityResult: "+result);
Log.i(TAG, "onActivityResult: "+result.getStatus());
Log.i(TAG, "onActivityResult: "+result.getSignInAccount());
Log.i(TAG, "onActivityResult: "+result.isSuccess());
Log.i(TAG, "onActivityResult: "+result.toString());
if (result.isSuccess()) {
// Google Sign In was successful, authenticate with Firebase
GoogleSignInAccount account = result.getSignInAccount();
firebaseAuthWithGoogle(account);
} else {
// Google Sign In failed, update UI appropriately
// [START_EXCLUDE]
Toast.makeText(LoginActivity.this, "Error", Toast.LENGTH_SHORT).show();
Log.i(TAG, "onActivityResult: "+result.getStatus().getStatusMessage());
// [END_EXCLUDE]
}
hideProgress();
}
}
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
代码示例来源:origin: jamorham/xDrip-plus
private void updateWearSyncBgsCapability() {
CapabilityApi.GetCapabilityResult capabilityResult =
Wearable.CapabilityApi.getCapability(
googleApiClient, CAPABILITY_WEAR_APP,
CapabilityApi.FILTER_REACHABLE).await(GET_CAPABILITIES_TIMEOUT_MS, TimeUnit.MILLISECONDS);
CapabilityInfo nodes;
if (!capabilityResult.getStatus().isSuccess()) {
Log.e(TAG, "updateWearSyncBgsCapability Failed to get capabilities, status: " + capabilityResult.getStatus().getStatusMessage());
nodes = null;
} else {
nodes = capabilityResult.getCapability();
}
if (nodes != null && nodes.getNodes().size() > 0) {
Log.d(TAG, "Updating wear sync nodes");
updateWearSyncBgsCapability(nodes);
}
}
代码示例来源:origin: NightscoutFoundation/xDrip
private void updateWearSyncBgsCapability() {
CapabilityApi.GetCapabilityResult capabilityResult =
Wearable.CapabilityApi.getCapability(
googleApiClient, CAPABILITY_WEAR_APP,
CapabilityApi.FILTER_REACHABLE).await(GET_CAPABILITIES_TIMEOUT_MS, TimeUnit.MILLISECONDS);
CapabilityInfo nodes;
if (!capabilityResult.getStatus().isSuccess()) {
Log.e(TAG, "updateWearSyncBgsCapability Failed to get capabilities, status: " + capabilityResult.getStatus().getStatusMessage());
nodes = null;
} else {
nodes = capabilityResult.getCapability();
}
if (nodes != null && nodes.getNodes().size() > 0) {
Log.d(TAG, "Updating wear sync nodes");
updateWearSyncBgsCapability(nodes);
}
}
代码示例来源:origin: jamorham/xDrip-plus
@Override
public void onResult(NodeApi.GetLocalNodeResult getLocalNodeResult) {
if (!getLocalNodeResult.getStatus().isSuccess()) {
Log.e(TAG, "ERROR: failed to getLocalNode Status=" + getLocalNodeResult.getStatus().getStatusMessage());
} else {
Log.d(TAG, "getLocalNode Status=: " + getLocalNodeResult.getStatus().getStatusMessage());
Node getnode = getLocalNodeResult.getNode();
localnode = getnode != null ? getnode.getDisplayName() + "|" + getnode.getId() : "";
Log.d(TAG, "setLocalNodeName. localnode=" + localnode);
}
}
});
代码示例来源:origin: Michenux/YourAppIdea
@SuppressWarnings({"MissingPermission"})
private void registerLocationUpdates() {
PendingResult<Status> result = LocationServices.FusedLocationApi
.requestLocationUpdates(
mGoogleApiClient,
mRequest,
this);
result.setResultCallback(status -> {
if (status.isSuccess()) {
// Successfully registered
} else if (status.hasResolution()) {
// Google provides a way to fix the issue
try {
status.startResolutionForResult(
SimpleMapFragment.this.getActivity(), // your current activity used to receive the result
LOCATIONSERVICES_RESOLUTION_RESULCODE); // the result code you'll look for in your onActivityResult method to retry registering
} catch (IntentSender.SendIntentException e) {
Log.e(YourApplication.LOG_TAG, "SimpleMapFragment start resolution failure: ", e);
}
} else {
// No recovery. Weep softly or inform the user.
Log.e(YourApplication.LOG_TAG, "SimpleMapFragment registering failed: " + status.getStatusMessage());
}
});
}
代码示例来源:origin: googlesamples/android-Quiz
@Override
public void onHandleIntent(Intent intent) {
if (intent.getAction().equals(ACTION_RESET_QUIZ)) {
final GoogleApiClient googleApiClient = new GoogleApiClient.Builder(this)
.addApi(Wearable.API)
.build();
ConnectionResult result = googleApiClient.blockingConnect(CONNECT_TIMEOUT_MS,
TimeUnit.MILLISECONDS);
if (!result.isSuccess()) {
Log.e(TAG, "QuizReportActionService failed to connect to GoogleApiClient.");
return;
}
CapabilityApi.GetCapabilityResult capabilityResult = Wearable.CapabilityApi
.getCapability(googleApiClient, RESET_QUIZ_CAPABILITY_NAME,
CapabilityApi.FILTER_REACHABLE)
.await(GET_CAPABILITIES_TIMEOUT_MS, TimeUnit.MILLISECONDS);
if (capabilityResult.getStatus().isSuccess()) {
sendResetMessage(googleApiClient, capabilityResult.getCapability());
} else {
Log.e(TAG, "Failed to get capabilities, status: "
+ capabilityResult.getStatus().getStatusMessage());
}
}
}
代码示例来源:origin: NordicSemiconductor/Android-nRF-Toolbox
/**
* Sends the given message to all connected wearables. If the path is equal to {@link Constants.UART#DEVICE_DISCONNECTED} the service will be stopped afterwards.
* @param path message path
* @param message the message
*/
private void sendMessageToWearables(final @NonNull String path, final @NonNull String message) {
if(mGoogleApiClient.isConnected()) {
new Thread(() -> {
NodeApi.GetConnectedNodesResult nodes = Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).await();
for(Node node : nodes.getNodes()) {
Logger.v(getLogSession(), "[WEAR] Sending message '" + path + "' to " + node.getDisplayName());
final MessageApi.SendMessageResult result = Wearable.MessageApi.sendMessage(mGoogleApiClient, node.getId(), path, message.getBytes()).await();
if(result.getStatus().isSuccess()){
Logger.i(getLogSession(), "[WEAR] Message sent");
} else {
Logger.w(getLogSession(), "[WEAR] Sending message failed: " + result.getStatus().getStatusMessage());
Log.w(TAG, "Failed to send " + path + " to " + node.getDisplayName());
}
}
if (Constants.UART.DEVICE_DISCONNECTED.equals(path))
stopService();
}).start();
} else {
if (Constants.UART.DEVICE_DISCONNECTED.equals(path))
stopService();
}
}
代码示例来源:origin: MrStahlfelge/gdx-gamesvcs
public boolean deleteGameStateSync(String fileId, ISaveGameStateResponseListener success) {
if (!isSessionActive()) {
if (success != null)
success.onGameStateSaved(false, "NO_CONNECTION");
return false;
}
// Open the snapshot, creating if necessary
Snapshots.OpenSnapshotResult open = Games.Snapshots.open(
mGoogleApiClient, fileId, false).await();
Snapshot snapshot = processSnapshotOpenResult(open, 0);
if (snapshot == null) {
Gdx.app.log(GAMESERVICE_ID, "Could not delete game state " + fileId + ": " +
open.getStatus().getStatusMessage());
if (success != null)
success.onGameStateSaved(false, open.getStatus().getStatusMessage());
return false;
}
Snapshots.DeleteSnapshotResult deleteResult = Games.Snapshots.delete(mGoogleApiClient,
snapshot.getMetadata()).await();
boolean deletionDone = deleteResult.getStatus().isSuccess();
Gdx.app.log(GAMESERVICE_ID, "Delete game state " + fileId + ": " + deletionDone +
" - " + open.getStatus().getStatusMessage());
if (success != null) {
success.onGameStateSaved(deletionDone,
deleteResult.getStatus().getStatusMessage());
}
return deletionDone;
}
代码示例来源:origin: mukeshsolanki/social-login-helper-Deprecated-
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == RC_SIGN_IN) {
final GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
if (result.isSuccess()) {
AsyncTask<Void, Void, String> task = new AsyncTask<Void, Void, String>() {
@Override protected String doInBackground(Void... params) {
String token = null;
try {
token =
GoogleAuthUtil.getToken(mContext, result.getSignInAccount().getAccount(), SCOPES);
} catch (IOException | GoogleAuthException e) {
e.printStackTrace();
}
return token;
}
@Override protected void onPostExecute(String token) {
GoogleSignInAccount acct = result.getSignInAccount();
mListener.onGoogleAuthSignIn(token, acct.getId());
}
};
task.execute();
} else {
mListener.onGoogleAuthSignInFailed(result.getStatus().getStatusMessage());
}
}
}
代码示例来源:origin: braintree/braintree_android
@Test
public void testGooglePaymentException_isSerializable() {
Status status = new Status(1, "Some status message");
GooglePaymentException exception = new GooglePaymentException("Some message", status);
Parcel parcel = Parcel.obtain();
exception.writeToParcel(parcel, 0);
parcel.setDataPosition(0);
GooglePaymentException actual = GooglePaymentException.CREATOR.createFromParcel(parcel);
assertEquals("Some message", actual.getMessage());
assertEquals("Some status message", actual.getStatus().getStatusMessage());
assertEquals(1, actual.getStatus().getStatusCode());
}
}
代码示例来源:origin: MrStahlfelge/gdx-gamesvcs
private boolean fetchGameStatesSync(IFetchGameStatesListResponseListener callback) {
if (!isSessionActive())
return false;
if (!driveApiEnabled)
throw new UnsupportedOperationException();
Snapshots.LoadSnapshotsResult loadResult = Games.Snapshots.load(mGoogleApiClient, forceRefresh).await();
if (!loadResult.getStatus().isSuccess()) {
Gdx.app.log(GAMESERVICE_ID, "Failed to fetch game states:" +
loadResult.getStatus().getStatusMessage());
callback.onFetchGameStatesListResponse(null);
return false;
}
SnapshotMetadataBuffer snapshots = loadResult.getSnapshots();
Array<String> gameStates = new Array<String>(snapshots.getCount());
for (SnapshotMetadata snapshot : snapshots) {
gameStates.add(snapshot.getTitle());
}
snapshots.release();
callback.onFetchGameStatesListResponse(gameStates);
return true;
}
内容来源于网络,如有侵权,请联系作者删除!