gpt4 book ai didi

android - Drive API list 和与 Drive App 的集成

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:06:18 25 4
gpt4 key购买 nike

我有一个 Android 应用,它在 Google 云端硬盘中使用 mime 类型创建自己的文件 application/vnd.test.type

我想让我的应用在 Google 云端硬盘应用打开时处理对此文件类型的请求,如所述 here .

我处理文件打开的 Activity 在我的 list 文件中如下:

    <activity android:name="DriveHandlerActivity" 
android:label="@string/app_name"
android:icon="@drawable/icon"
android:exported="true" >
<meta-data android:name="com.google.android.apps.drive.APP_ID"
android:value="id=MY_ID"/>
<intent-filter >
<action android:name="com.google.android.apps.drive.DRIVE_OPEN"/>
<data android:mimeType="application/vnd.test.type"/>
</intent-filter>
</activity>

当我尝试在 Google Drive 应用程序中打开文件时,我得到了预期的“打开方式...”对话框,我的应用程序被列为唯一能够处理此文件类型的条目。不幸的是,在确认操作后,我会看到一个对话框。

Error Dialog

然后我唯一的选择是按“取消”按钮,这会返回到 Google Drive 应用程序。

我不完全相信我的元数据是正确的,因为根据您查看的位置使用不同的名称引用 ID。一些documentation calls it the App ID ,有些人称之为项目 ID (See here at 26:44) .我尝试使用我的 Google Apis 控制台中列出的“项目 ID”以及同一页面上的项目编号(来自 URL)。无论我选择哪个值作为 ID,我都会得到同样的错误。

据我所知,下一步应该是在我的应用程序中处理 Intent ,但由于所描述的错误, Intent 从未到达。谁能告诉我我做错了什么?

最佳答案

当前存在一个问题,要求您的应用程序列在 Chrome Webstore 中(甚至只对受信任的测试人员)以便 Open With 流程正常工作。

但是,即使问题得到解决,您的应用程序也无法访问该文件,直到 Google Play Services API发布。唯一的解决方法是请求对整个驱动器范围 https://www.googleapis.com/auth/drive 的授权,不推荐但对调试有用。

当解决 Chrome 网上应用店限制时,我会更新此答案。

关于android - Drive API list 和与 Drive App 的集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11363317/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com