支持 GCM 网络管理器的 Google Play Services 的最低版本代码是多少?

What is the minimum version code of Google Play Services that supports GCM Network Manager?

我想在我的应用程序中使用 GCM Network Manager。此库需要在用户设备上安装 Google Play Service 版本 7.5 及更高版本。我想检查是否安装了 Google Play Services 并且它的版本高于 7.5。我做了如下:

private boolean isGcmNetworkManagerAvailable(Context context) {
    final int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(context);
    if (status != ConnectionResult.SUCCESS) {
        return false;
    }

    final String gpsPackageName = GooglePlayServicesUtil.GOOGLE_PLAY_SERVICES_PACKAGE;
    PackageManager pm = context.getPackageManager();
    try {
        PackageInfo gpsPackageInfo = pm.getPackageInfo(gpsPackageName,0);
        int versionCode = gpsPackageInfo.versionCode;
        //
        // What is the version code of Google Play Services version 7.5? 
        //
        if(versionCode < GOOGLE_PLAY_SERVICES_7_5_VERSION_CODE) {
            return false;
        }
    } catch (PackageManager.NameNotFoundException e) {
        return false;
    }

    return true;
}

问题是我不知道 Google Play Services 7.5 版的确切版本代码以检查此方法。

希望这会有所帮助

/**
 * 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() {
    int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
            GooglePlayServicesUtil.getErrorDialog(resultCode, this,
                    PLAY_SERVICES_RESOLUTION_REQUEST).show();
        } else {

        }
        return false;
    }
    return true;
}

基于此 google Play Services 的版本代码只是从其版本代码创建的 7 位数字,因此版本 7.5 有 7500000 版本代码。