N S*_*rma 6 android google-cloud-messaging

GCMGoogle Play ServiceGoogle Play Service
Google Play Service
/**
 * 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.
 */
public static boolean checkPlayServices(Context mContext) {
    int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(mContext);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
            GooglePlayServicesUtil.getErrorDialog(resultCode, (Activity)mContext,Constants.PLAY_SERVICES_RESOLUTION_REQUEST).show();
        }
        return false;
    }
    return true;
}

//这里检查设备是否安装了Google Play服务//如果已安装,则使用GCM注册设备//否则将用户重定向到Play商店进行安装.

        if(Utils.checkPlayServices(getActivity())) {
            new RegisterGCMDeviceAsynTask(new TaskCompleteListener() {

                @Override
                public void onTaskCompleted(String result) {
                    new TeemWurkAsyncTask(new TaskCompleteListener() {

                        @Override
                        public void onTaskCompleted(String result) {
                            Logger.d(TAG, result);
                        }
                    }, Constants.LOGIN_API_CALL).execute("");
                }
            }).execute();
        } else {
            // display the dialog that device do not have Google Play Service installed.

        }