活动选择器中列出的活动已导出

活动选择器中列出的活动已导出

本文介绍了活动选择器中列出的活动已导出= false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个类似的申请(一个免费,一个付费).

I have two similar applications (one free, one paid).

使用exported="false"

    <activity
        android:name=".MyActivity"
        android:exported="false"
        android:noHistory="true" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="vnd.android.cursor.item/vnd.mine" />
        </intent-filter>
    </activity>

当我从免费应用程序以适当的隐式意图调用startActivity时,活动选择器就会出现.

When I call startActivity with the appropriate implicit intent from the free app, the activity picker appears.

我不明白为什么付费应用中的活动会出现,因为它是 exported="false"

I don't understand why the activity from the paid app appears, since it is exported="false"

我想我可以基于URL添加一个意图过滤器,但是我的问题是:当文档读取时,为什么另一个应用程序的活动会出现

I suppose I can add an intent filter based on the URL, but my question is: why does the activity from the other app appear when the doc reads

推荐答案

因为您有匹配的<intent-filter>.由于不需要<intent-filter>进行非导出的活动,因此只需将其删除并在开始此活动时使用显式的Intent.

Because you have a matching <intent-filter>. Since you do not need the <intent-filter> for a non-exported activity, simply delete it and use an explicit Intent when starting this activity.

我有相同的问题,并被告知是预期的行为,并且该错误是因为我们的应用程序中没有有用的<intent-filter>而导致的.引用戴安娜·哈克伯恩(Dianne Hackborn):

I had the same question and was told that this was expected behavior and the bug is in our app for having a useless <intent-filter>. Quoting Dianne Hackborn:

这篇关于活动选择器中列出的活动已导出= false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 13:47