Android 开发中问题收集(六):将自己应用添加到微信和QQ其他应用列表

一、将自己的app添加到微信和QQ的文件打开选择其他应用列表中

通过,Android Studio 控制台日志看,微信打开其他应用传递的Intent对象

Activity_launch_request time:659490872 intent:Intent { act=android.intent.action.VIEW 
dat=content://com.tencent.mm.external.fileprovider/external/tencent/MicroMsg/Download/新建文本文档 (2).txt 
typ=text/plain flg=0x10000001 pkg=com.android.htmlviewer }

QQ打开其他应用的Intent

{act=android.intent.action.VIEW cat=[android.intent.category.DEFAULT] 
dat=content://com.tencent.mobileqq.fileprovider/external_files/storage/emulated/0/
Tencent/QQfile_recv/OPPO云真机日志文件201908281538.txt
 typ=text/plain flg=0x1 pkg=com.android.htmlviewer 
 cmp=com.android.htmlviewer/.HTMLViewerActivity (has extras)} from uid 10162

可以看到看到
Actionandroid.intent.action.VIEW
datacontent://com.tencent.mm.external.fileprovider/external/tencent/MicroMsg/Download/新建文本文档 (2).txt
mimeTypetext/plain
pkg :包名 com.android.htmlviewer
flg0x10000001

根据以上信息配置 intent-filte

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:scheme="content"/>
    <!-- 允许所有类型文件-->
    <data android:mimeType="*/*" />
</intent-filter>
二、将自己的app作为其他应用提供给其他app使用
<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <!-- 允许所有类型文件-->
    <data android:scheme="file"/>
</intent-filter>

具体的scheme配置参考:scheme配置介绍

  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值