本文整理匯總了Java中com.google.android.gms.common.ConnectionResult.getResolution方法的典型用法代碼示例。如果您正苦於以下問題:Java ConnectionResult.getResolution方法的具體用法?Java ConnectionResult.getResolution怎麽用?Java ConnectionResult.getResolution使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.android.gms.common.ConnectionResult
的用法示例。
在下文中一共展示了ConnectionResult.getResolution方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onConnectionFailed
import com.google.android.gms.common.ConnectionResult; //導入方法依賴的package包/類
@Override
public void onConnectionFailed(ConnectionResult result) {
LOGD(TAG, "onConnectionFailed() reached, error code: " + result.getErrorCode()
+ ", reason: " + result.toString());
disconnectDevice(mDestroyOnDisconnect, false /* clearPersistentConnectionData */,
false /* setDefaultRoute */);
mConnectionSuspended = false;
if (mMediaRouter != null) {
mMediaRouter.selectRoute(mMediaRouter.getDefaultRoute());
}
for (BaseCastConsumer consumer : mBaseCastConsumers) {
consumer.onConnectionFailed(result);
}
PendingIntent pendingIntent = result.getResolution();
if (pendingIntent != null) {
try {
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
LOGE(TAG, "Failed to show recovery from the recoverable error", e);
}
}
}
示例2: onConnectionFailed
import com.google.android.gms.common.ConnectionResult; //導入方法依賴的package包/類
@Override
public void onConnectionFailed(ConnectionResult result) {
Log.i(TAG, "GoogleApiClient connection failed: " + result.toString());
if (result.getErrorCode() == SERVICE_MISSING){
showMessage("Google Drive API not Found on this Device");
Log.e(TAG, "Google Drive SERVICE_MISSING");
}
if (result.getErrorCode() == SERVICE_VERSION_UPDATE_REQUIRED){
showMessage("Google Play Services update required. Please update in Google Play store.");
Log.e(TAG, "Google Play Services update required");
mGoogleApiClient.getContext().startActivity(new Intent(mGoogleApiClient.getContext(), MainActivity.class)
.putExtra("PlayServicesUpdate", true).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
}
PendingIntent pI = result.getResolution();
if (pI != null) {
Log.v(TAG, "PendingIntent: " + pI.getIntentSender().toString());
mGoogleApiClient.getContext().startActivity(new Intent(mGoogleApiClient.getContext(), MainActivity.class)
.putExtra("resolution", pI).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
} else {
Log.e(TAG, "Pending Intent resolution was Null");
}
// If we don't stop this service, we tend to have an invalid API client
// when we call the first Create new Drive file command
stopSelf(mStartID);
}