Android应用需要Google Play服务更新 - 打开按钮而不是更新

时间:2013-11-19 08:23:58

标签: android

要使用GCM(Google云消息传递),我需要在我的应用程序中实施Google Play服务库。一切都适用于我的Galaxy S2(Android 4.1.2),但在我的HTC(Android 2.2.2)上,我无法更新Google Play服务。

创建应用程序时(onCreate),我会检查是否已安装Google Play服务或是否需要更新:

public static boolean isGooglePlayServiceEnabled(Context context)
{
    return GooglePlayServicesUtil.isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS ? true : false;
}

在我的活动中:

onCreate(Bundle savedInstance)
{
    // Some code....
    if (!isGooglePlayInstalled(this))
    {
        int errorCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(instance)
        if (errorCode == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED)
        {
            // Alert Dialog and prompt user to update App
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.google.android.gms")));
        }
    }
}

用户被重定向到市场以更新Google Play服务。但是当他到达时,没有“更新”按钮!它只有2个按钮:“打开”和“卸载”!

我该怎么办?

更新

我刚刚发现Google不再支持Android< = 8(2.2.2)。

  

超过97%的设备现在运行Android 2.3(Gingerbread)或   更新的平台版本,我们正在放弃对Froyo的支持   发布Google Play服务SDK以使其成为可能   在未来提供更强大的API。这意味着你不会   能够在运行Android 2.2(Froyo)的设备上使用这些新API。

1 个答案:

答案 0 :(得分:0)

您的设备没有最新版本的Google Play服务。如果没有可用的更新,PlayStore将只提供打开应用程序。