本文整理汇总了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);
}