本文整理汇总了Java中com.google.android.gms.common.GooglePlayServicesUtil.isUserRecoverableError方法的典型用法代码示例。如果您正苦于以下问题:Java GooglePlayServicesUtil.isUserRecoverableError方法的具体用法?Java GooglePlayServicesUtil.isUserRecoverableError怎么用?Java GooglePlayServicesUtil.isUserRecoverableError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.common.GooglePlayServicesUtil
的用法示例。
在下文中一共展示了GooglePlayServicesUtil.isUserRecoverableError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkPlayServices
import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
private boolean checkPlayServices() {
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
GooglePlayServicesUtil.getErrorDialog(
resultCode, this, REQUEST_CODE_PLAY_SERVICES).show();
} else {
Dialog playServicesDialog = DialogFactory.createSimpleOkErrorDialog(
this,
getString(R.string.dialog_error_title),
getString(R.string.error_message_play_services)
);
playServicesDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
finish();
}
});
playServicesDialog.show();
}
return false;
}
return true;
}
示例2: checkPlayServices
import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
private boolean checkPlayServices() {
int resultCode = GooglePlayServicesUtil
.isGooglePlayServicesAvailable(getActivity());
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
GooglePlayServicesUtil.getErrorDialog(resultCode, getActivity(),
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
Toast.makeText(getContext(),
getString(R.string.location_services_not_supported), Toast.LENGTH_LONG)
.show();
getActivity().finish();
}
return false;
}
return true;
}
示例3: checkPlayService
import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
private boolean checkPlayService(FragmentActivity fragmentActivity)
throws IllegalArgumentException {
int errorCode =
GooglePlayServicesUtil.
isGooglePlayServicesAvailable(fragmentActivity);
if (ConnectionResult.SUCCESS != errorCode) {
if (GooglePlayServicesUtil.isUserRecoverableError(errorCode)) {
Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(
errorCode, fragmentActivity, REQUEST_CODE);
ErrorDialogFragment errorFragment =
new ErrorDialogFragment();
errorFragment.setDialog(errorDialog);
errorFragment.show(fragmentActivity.getSupportFragmentManager(),
TAG);
return false;
} else {
throw new IllegalArgumentException("Play Service not supported in this device");
}
} else {
return true;
}
}
示例4: checkPlayServices
import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
public static boolean checkPlayServices(Context act) {
Activity activity = (Activity)act;
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activity);
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
GooglePlayServicesUtil.getErrorDialog(resultCode, activity,
AppConstants.PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
Log.i("checkPlayServices", "This device is not supported.");
activity.finish();
}
return false;
}
return true;
}
示例5: checkGooglePlayServicesAvailable
import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
private boolean checkGooglePlayServicesAvailable()
{
final int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
if (status == ConnectionResult.SUCCESS)
{
return true;
}
Log.e("MAIN ACTIVITY", "Google Play Services not available: " + GooglePlayServicesUtil.getErrorString(status));
if (GooglePlayServicesUtil.isUserRecoverableError(status))
{
final Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(status, this, 1);
if (errorDialog != null)
{
errorDialog.show();
}
}
return false;
}
示例6: checkPlayServices
import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
/**
* Method to verify google play services on the device
* */
private boolean checkPlayServices() {
int resultCode = GooglePlayServicesUtil
.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
Toast.makeText(getApplicationContext(),
"This device is not supported.", Toast.LENGTH_LONG)
.show();
finish();
}
return false;
}
return true;
}
示例7: isGoogelPlayInstalled
import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
private boolean isGoogelPlayInstalled() {
int resultCode = GooglePlayServicesUtil
.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
ACTION_PLAY_SERVICES_DIALOG).show();
} else {
Toast.makeText(getApplicationContext(),
"Google Play Service is not installed",
Toast.LENGTH_SHORT).show();
finish();
}
return false;
}
return true;
}
示例8: checkPlayServices
import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
private boolean checkPlayServices() {
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
GooglePlayServicesUtil.getErrorDialog(resultCode, this, PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
Toast.makeText(getApplicationContext(),
"This device is not supported.", Toast.LENGTH_LONG)
.show();
finish();
}
return false;
}
return true;
}
示例9: checkPlayServices
import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
/** Are we still able to use Play Services?
*
* @return boolean
*/
private boolean checkPlayServices() {
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
//toggleConnectToSend(false);
} else {
Log.i(TAG, "This device is not supported");
finish();
}
return false;
}
return true;
}
示例10: showErrorDialog
import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
private void showErrorDialog(ConnectionResult connectionResult) {
int errorCode = connectionResult.getErrorCode();
if (GooglePlayServicesUtil.isUserRecoverableError(errorCode)) {
// Show the default Google Play services error dialog which may still start an intent
// on our behalf if the user can resolve the issue.
GooglePlayServicesUtil.getErrorDialog(errorCode, this, RC_SIGN_IN,
new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
mShouldResolve = false;
updateUI(false);
}
}).show();
} else {
// No default Google Play Services error, display a message to the user.
String errorString = getString(R.string.play_services_error_fmt, errorCode);
Toast.makeText(this, errorString, Toast.LENGTH_SHORT).show();
mShouldResolve = false;
updateUI(false);
}
}
示例11: checkPlayServices
import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
/**
* Checks if Google Play Services are installed and if not it initializes
* opening the dialog to allow user to install Google Play Services.
* @return a boolean indicating if the Google Play Services are available.
*/
private boolean checkPlayServices() {
int resultCode = GooglePlayServicesUtil
.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
Log.i(TAG, "This device is not supported.");
finish();
}
return false;
}
return true;
}
示例12: checkPlayServices
import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
/**
* Check the device to make sure it has the Google Play Services APK. If
* it doesn't, display a dialog that allows users to download the APK from
* the Google Play Store or enable it in the device's system settings.
*/
private boolean checkPlayServices() {
final int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(cordova.getActivity());
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
GooglePlayServicesUtil.getErrorDialog(resultCode, cordova.getActivity(), 9000).show();
}
});
} else {
Log.i(TAG, "This device is not supported.");
cordova.getActivity().finish();
}
return false;
}
return true;
}
示例13: checkPlayServices
import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
private boolean checkPlayServices() {
int resultCode = GooglePlayServicesUtil
.isGooglePlayServicesAvailable(this);
// When Play services not found in device
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
// Show Error dialog to install Play services
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
Toast.makeText(
getApplicationContext(),
"This device doesn't support Play services, App will not work normally",
Toast.LENGTH_LONG).show();
finish();
}
return false;
} else {
Toast.makeText(
getApplicationContext(),
"This device supports Play services, App will work normally",
Toast.LENGTH_LONG).show();
}
return true;
}
示例14: checkPlayServices
import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
private boolean checkPlayServices() {
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
finish();
}
return false;
}
return true;
}
示例15: onConnectionFailed
import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
Activity activity = getActivity("onConnectionFailed()");
if (activity == null) {
return;
}
if (connectionResult.hasResolution()) {
if (sCanShowSignInUi) {
LOGD(TAG, "onConnectionFailed, with resolution. Attempting to resolve.");
sCanShowSignInUi = false;
try {
mResolving = true;
connectionResult.startResolutionForResult(activity,
REQUEST_RECOVER_FROM_PLAY_SERVICES_ERROR);
} catch (IntentSender.SendIntentException e) {
LOGE(TAG, "SendIntentException occurred: " + e.getMessage());
e.printStackTrace();
}
} else {
LOGD(TAG, "onConnectionFailed with resolution but sCanShowSignInUi==false.");
reportAuthFailure();
}
return;
}
LOGD(TAG, "onConnectionFailed, no resolution.");
final int errorCode = connectionResult.getErrorCode();
if (GooglePlayServicesUtil.isUserRecoverableError(errorCode) && sCanShowSignInUi) {
sCanShowSignInUi = false;
GooglePlayServicesUtil.getErrorDialog(errorCode, activity,
REQUEST_PLAY_SERVICES_ERROR_DIALOG).show();
} else {
reportAuthFailure();
}
}