gpt4 book ai didi

android - 从邮件附件打开 x509 证书 (.crt) 时接收 Intent

转载 作者:行者123 更新时间:2023-11-30 02:25:37 25 4
gpt4 key购买 nike

当用户在他/她的 Android 邮件客户端/应用程序中单击此附件时,我想从 .crt 文件附件中读取/提取数据。我在 AndroidManifest.xml 中使用了以下 Intent 过滤器:

        <intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="content" />
<data android:mimeType="application/x-x509-user-cert"
android:pathPattern=".*\\.crt"/>
</intent-filter>

但他不起作用。此外,从邮件应用程序打开 CRT 文件时,android 会提示安装证书。这是否意味着指定的操作应该是别的东西?这个 Intent 过滤器有什么问题?

Android 版本测试:4.1.2

最佳答案

您可能会发现 this source code有用。作者为每个证书文件扩展名设置了两行,其中一行被注释掉以示区别。

此外,根据电子邮件应用程序发布附件 Intent 的方式,方案可能是"file"而不是“内容”。我对此有点不清楚。我建议两者都试一下。 :-)

<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="file" />
<!-- <data android:mimeType="*/*" />-->
<data android:pathPattern=".*\\.crt" />
<data android:host="*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="file" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.crt" />
<data android:host="*" />
</intent-filter>

关于android - 从邮件附件打开 x509 证书 (.crt) 时接收 Intent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27934145/

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