【问题标题】:How to add Google Drive account if my Android device doesn't have Google Play Service如果我的 Android 设备没有 Google Play 服务,如何添加 Google Drive 帐户
【发布时间】:2015-08-19 10:48:30
【问题描述】:

我正在编写一个 Android 应用程序,如果我的 Android 设备没有 Google Play 服务,我该如何添加 Google Drive 帐户,有些设备的系统中没有 Google Play 服务,我检查了 google drive sdk Android 和 REST API,它们都依赖于 Google Play Service 来获取 Google 帐户。 https://developers.google.com/drive/android/introhttps://developers.google.com/drive/web/quickstart/android 有一个OfficeSuite应用,如果当前设备有Google Play Service,它使用上面的SDK来获取谷歌账号,否则,它会显示一个谷歌认证页面来获取谷歌账号。我检查了google drive sdk,但我没有找到适用于Android的功能,所以谁知道我该怎么做?

【问题讨论】:

标签: android google-drive-api


【解决方案1】:

【讨论】:

  • 此解决方案能否让我在不将 Google 帐户添加到客户经理的情况下使用 Google 云端硬盘?
【解决方案2】:

Google Play Services 的功能对您的应用至关重要,因此您的应用无法正常运行。

您可以使用GooglePlayServicesUtil.isGooglePlayServicesAvailable(android.content.Context) 检查是否在您的应用内启用了服务 如果播放服务可用,则返回 ConnectionResult.SUCCESS。

由于 Google Play 服务不是清单中声明的​​功能,因此您的应用应该可以在任何设备上正常安装,但如果您在未检查 API 是否可用的情况下使用这些 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();
        }
    };

【讨论】:

  • 是的,你是对的。但是OfficeSuite应用程序可以显示一个谷歌认证页面来获取谷歌账号,这个认证页面和google drive sdk for IOS提供的这个认证页面是一样的。目前我没有足够的权限上传图纸,我已经捕获了OfficeSuite应用程序中出现的谷歌认证页面,当我有权限时,我会上传它。反正方法是可以的,想知道OfficeSuite怎么做,还没找到可以在Android上显示谷歌认证页面的sdk。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-02-15
  • 1970-01-01
  • 2015-01-11
  • 1970-01-01
  • 2018-03-17
  • 2016-11-28
  • 1970-01-01
相关资源
最近更新 更多