当前位置: 首页>>代码示例>>Java>>正文


Java GoogleApiAvailability.getErrorDialog方法代码示例

本文整理汇总了Java中com.google.android.gms.common.GoogleApiAvailability.getErrorDialog方法的典型用法代码示例。如果您正苦于以下问题:Java GoogleApiAvailability.getErrorDialog方法的具体用法?Java GoogleApiAvailability.getErrorDialog怎么用?Java GoogleApiAvailability.getErrorDialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.common.GoogleApiAvailability的用法示例。


在下文中一共展示了GoogleApiAvailability.getErrorDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onResume

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
@Override
protected void onResume() {
    super.onResume();

    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    int errorCode = apiAvailability.isGooglePlayServicesAvailable(this);

    if (errorCode != ConnectionResult.SUCCESS) {
        Dialog errorDialog = apiAvailability.getErrorDialog(this,
                errorCode,
                REQUEST_ERROR,
                new DialogInterface.OnCancelListener() {
                    @Override
                    public void onCancel(DialogInterface dialogInterface) {
                        // Leave if services are unavailable.
                        finish();
                    }
                });

        errorDialog.show();
    }
}
 
开发者ID:rsippl,项目名称:AndroidProgramming3e,代码行数:23,代码来源:LocatrActivity.java

示例2: isGooglePlayServicesAvailable

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
public boolean isGooglePlayServicesAvailable() {
    GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
    int code = googleApiAvailability.isGooglePlayServicesAvailable(context);
    if (code != ConnectionResult.SUCCESS) {
        if (googleApiAvailability.isUserResolvableError(code)) {
            googleApiAvailability.getErrorDialog(context, code, PLAY_SERVICE_RESOLUTION_REQUEST, this);
        } else {
            showLog("THIS DEVICE IS NOT SUPPORTED");
            Util.killAppProccess();
        }
        showLog("isGooglePlayServicesAvailable - " + "false");
        return false;
    }
    showLog("isGooglePlayServicesAvailable - " + "true");
    return true;
}
 
开发者ID:pedromassango,项目名称:Programmers,代码行数:17,代码来源:GoogleServices.java

示例3: onResume

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
@Override
public void onResume() {
    super.onResume();

    GoogleApiAvailability apiAvailablity = GoogleApiAvailability.getInstance();
    int errorCode = apiAvailablity.isGooglePlayServicesAvailable(getContext());

    if (errorCode != ConnectionResult.SUCCESS) {
        Dialog errorDialog = apiAvailablity.getErrorDialog(getActivity(), errorCode,
                REQUEST_ERROR, new DialogInterface.OnCancelListener() {
                    @Override
                    public void onCancel(DialogInterface dialog) {
                        getActivity().finish();
                    }
                });
        errorDialog.show();
    }
}
 
开发者ID:ivicel,项目名称:Android-Programming-BigNerd,代码行数:19,代码来源:LocatrFragment.java

示例4: onResume

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    updateUI();
    
    //checking if Play Store app installed on device
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    int errorCode = apiAvailability.isGooglePlayServicesAvailable(getActivity());

    if (errorCode != ConnectionResult.SUCCESS) {
        Dialog errorDialog = apiAvailability
                .getErrorDialog(getActivity(), errorCode, REQUEST_ERROR,
                        new DialogInterface.OnCancelListener() {
                    @Override
                    public void onCancel(DialogInterface dialog) {
                        getActivity().finish();
                    }
                });
        errorDialog.show();
    }
}
 
开发者ID:plweegie,项目名称:piast-trail,代码行数:22,代码来源:PlaceListFragment.java

示例5: onResume

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
@Override
protected void onResume() {
    super.onResume();
    
    //checking if Play Store app installed on device
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    int errorCode = apiAvailability.isGooglePlayServicesAvailable(this);

    if (errorCode != ConnectionResult.SUCCESS) {
        Dialog errorDialog = apiAvailability
                .getErrorDialog(this, errorCode, REQUEST_ERROR,
                        new DialogInterface.OnCancelListener() {
                    @Override
                    public void onCancel(DialogInterface dialog) {
                        finish();
                    }
                });
        errorDialog.show();
    }
}
 
开发者ID:plweegie,项目名称:piast-trail,代码行数:21,代码来源:PlaceDetailsActivity.java

示例6: showGooglePlayServicesAvailabilityErrorDialog

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
/**
 * Display an error dialog showing that Google Play Services is missing
 * or out of date.
 *
 * @param connectionStatusCode code describing the presence (or lack of)
 *                             Google Play Services on this device.
 */
void showGooglePlayServicesAvailabilityErrorDialog(
        final int connectionStatusCode) {
    if (mProgress != null && mProgress.isShowing()) {
        mProgress.dismiss();
    }

    try {
        GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
        Dialog dialog = apiAvailability.getErrorDialog(
                getActivity(),
                connectionStatusCode,
                ConstantValues.REQUEST_GOOGLE_PLAY_SERVICES);
        dialog.show();
    } catch (Exception e) {
        Utils.showNotReportableErrorDialog(getActivity(), e.getMessage(), "");
    }
}
 
开发者ID:mkeresztes,项目名称:AndiCar,代码行数:25,代码来源:PreferenceActivity.java

示例7: googleServicesAvailable

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
public boolean googleServicesAvailable() {
    GoogleApiAvailability api = GoogleApiAvailability.getInstance();
    int isAvailable = api.isGooglePlayServicesAvailable(this);
    if (isAvailable == ConnectionResult.SUCCESS) {
        return true;
    } else if (api.isUserResolvableError(isAvailable)) {
        Dialog dialog = api.getErrorDialog(this, isAvailable, 0);
        dialog.show();
    } else {
        Toast.makeText(this, "Cannot connect to Google Play Services", Toast.LENGTH_SHORT).show();
    }
    return false;
}
 
开发者ID:rahul051296,项目名称:quake-alert-android-app,代码行数:14,代码来源:QuakeActivity.java

示例8: showGooglePlayServicesAvailabilityErrorDialog

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
/**
 * Display an error dialog showing that Google Play Services is missing
 * or out of date.
 *
 * @param connectionStatusCode code describing the presence (or lack of)
 *                             Google Play Services on this device.
 */
private void showGooglePlayServicesAvailabilityErrorDialog(
        final int connectionStatusCode) {
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    Dialog dialog = apiAvailability.getErrorDialog(
            context,
            connectionStatusCode,
            REQUEST_GOOGLE_PLAY_SERVICES);
    dialog.show();
}
 
开发者ID:Pl4gue,项目名称:homeworkManager-android,代码行数:17,代码来源:GetHomeworkPresenter.java

示例9: showGooglePlayServicesAvailabilityErrorDialog

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
/**
 * Display an error dialog showing that Google Play Services is missing
 * or out of date.
 *
 * @param connectionStatusCode code describing the presence (or lack of)
 *                             Google Play Services on this device.
 */
private void showGooglePlayServicesAvailabilityErrorDialog(final int connectionStatusCode) {
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    Dialog dialog = apiAvailability.getErrorDialog(
            getActivity(),
            connectionStatusCode,
            REQUEST_GOOGLE_PLAY_SERVICES);
    dialog.show();
}
 
开发者ID:piskula,项目名称:FuelUp,代码行数:16,代码来源:BackupFragment.java

示例10: showGooglePlayServicesAvailabilityErrorDialog

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
private void showGooglePlayServicesAvailabilityErrorDialog(final int connectionStatusCode) {
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    Dialog dialog = apiAvailability.getErrorDialog(
            this,
            connectionStatusCode,
            REQUEST_GOOGLE_PLAY_SERVICES);
    dialog.show();
}
 
开发者ID:piskula,项目名称:FuelUp,代码行数:9,代码来源:CheckPermissionsActivity.java

示例11: checkPlayServices

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
private boolean checkPlayServices(){
	GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
	int resultCode = googleApiAvailability.isGooglePlayServicesAvailable(mActivity);
	if(resultCode != ConnectionResult.SUCCESS) {
		if(googleApiAvailability.isUserResolvableError(resultCode)) {
			if(mErrorDialog == null) {
				mErrorDialog = googleApiAvailability.getErrorDialog(mActivity, resultCode, 2404);
				mErrorDialog.setCancelable(false);
			}
			if(!mErrorDialog.isShowing())
				mErrorDialog.show();
		}
	}
	return resultCode == ConnectionResult.SUCCESS;
}
 
开发者ID:Skullper,项目名称:SimpleLocationGetter,代码行数:16,代码来源:SimpleLocationGetter.java

示例12: isGoogleServicesAvailable

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
/**
 * Checks if google services are available
 * @return
 */
public boolean isGoogleServicesAvailable() {
    GoogleApiAvailability api = GoogleApiAvailability.getInstance();
    int isAvailable = api.isGooglePlayServicesAvailable(this);
    if (isAvailable == ConnectionResult.SUCCESS) {
        return Boolean.TRUE;
    } else if (api.isUserResolvableError(isAvailable)) {
        Dialog dialog = api.getErrorDialog(this, isAvailable, 0);
        dialog.show();
    } else {
        toastMe("Can't connect to play services!", this);
    }
    return Boolean.FALSE;
}
 
开发者ID:CMPUT301F17T17,项目名称:Habitizer,代码行数:18,代码来源:DummyMainActivity.java

示例13: googleplayservice

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
public boolean googleplayservice() {
    GoogleApiAvailability api = GoogleApiAvailability.getInstance();
    int isAvaible = api.isGooglePlayServicesAvailable(this);
    if (isAvaible == ConnectionResult.SUCCESS) {
        return true;
    } else if (api.isUserResolvableError(isAvaible)) {
        Dialog dialog = api.getErrorDialog(this, isAvaible, 0);
        dialog.show();
    } else {
        Toast.makeText(this, "Can't Connect to play services", Toast.LENGTH_LONG).show();
    }
    return false;
}
 
开发者ID:Francescopaolo44,项目名称:MedicalMe,代码行数:14,代码来源:MapsActivity.java

示例14: showGooglePlayServicesAvailabilityErrorDialog

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
/**
 * Display an error dialog showing that Google Play Services is missing
 * or out of date.
 *
 * @param connectionStatusCode code describing the presence (or lack of)
 *                             Google Play Services on this device.
 */
void showGooglePlayServicesAvailabilityErrorDialog(
        final int connectionStatusCode) {
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    Dialog dialog = apiAvailability.getErrorDialog(
            CheckupReminders.this,
            connectionStatusCode,
            REQUEST_GOOGLE_PLAY_SERVICES);
    dialog.show();
}
 
开发者ID:webianks,项目名称:Crimson,代码行数:17,代码来源:CheckupReminders.java

示例15: showGooglePlayServicesAvailabilityErrorDialog

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
void showGooglePlayServicesAvailabilityErrorDialog(
        final int connectionStatusCode) {
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    Dialog dialog = apiAvailability.getErrorDialog(
            ClockActivity.this,
            connectionStatusCode,
            REQUEST_GOOGLE_PLAY_SERVICES);
    dialog.show();
}
 
开发者ID:jcolladosp,项目名称:ePills,代码行数:10,代码来源:ClockActivity.java


注:本文中的com.google.android.gms.common.GoogleApiAvailability.getErrorDialog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。