首页 文章

如果我的Android设备没有Google Play服务,如何添加Google Cloud 端硬盘帐户

提问于
浏览
3

我有Google Play服务,如何添加Google Cloud 端硬盘帐户,有些设备在他们的系统中没有Google Play服务,我已经检查了Android和REST API的google drive sdk,他们都依靠Google Play服务获取Google帐户 . https://developers.google.com/drive/android/intro https://developers.google.com/drive/web/quickstart/android有一个OfficeSuite应用,如果当前设备有Google Play服务,它会使用上面的SDK来获取Google帐户,否则,它会显示一个Google身份验证页面来获取Google帐户 . 我已经检查了谷歌驱动器sdk,但我还没有找到Android的功能,所以谁知道我怎么能这样做?

2 回答

  • 0

    Google Play服务的功能对于您的应用至关重要,因此无法让您的应用运行 .

    您可以使用 GooglePlayServicesUtil.isGooglePlayServicesAvailable(android.content.Context) 检查是否已在您的应用中启用服务,如果Play服务可用,则返回 ConnectionResult.SUCCESS .

    由于Google Play服务不是清单中声明的功能,因此您的应用应该可以在任何设备上正常安装,但如果您使用API而不检查它们是否可用,则可能会在以后崩溃 .

    但是,您可以随时要求用户安装Google Play服务(如果他们在您的应用中使用此代码而无法在设备上安装) .

    public OnClickListener getGooglePlayServicesListener()
    {
        return new OnClickListener() 
        {
            @Override
            public void onClick(DialogInterface dialog, int which) 
            {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.google.android.gms"));
                startActivity(intent);
    
                //Finish the activity so they can't circumvent the check
                finish();
            }
        };
    
  • 1

相关问题