如何停止从android中的其他应用程序打开应用程序?

时间:2013-01-17 14:56:39

标签: android

我开始知道,我们可以从android中的其他应用程序打开一个应用程序。所以我使用android:exported="false"来限制它。但是当我为Launcher添加相同的标签时,我无法打开该应用程序。

<activity
    android:name="SplashScreen"
    android:label="@string/app_name"
    android:screenOrientation="portrait">
     <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="*/*" />
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter> 
</activity>

(因为我的应用程序应该能够打开任何文件,我正在应用2个意图过滤器)

1 个答案:

答案 0 :(得分:2)

<强>机器人:导出

Whether or not the activity can be launched by components of other applications — "true" if it can be, and "false" if not. If "false", the activity can be launched only by components of the same application or applications with the same user ID.

The default value depends on whether the activity contains intent filters. The absence of any filters means that the activity can be invoked only by specifying its exact class name. This implies that the activity is intended only for application-internal use (since others would not know the class name).

So in this case, the default value is "false". On the other hand, the presence of at least one filter implies that the activity is intended for external use, so the default value is "true". This attribute is not the only way to limit an activity's exposure to other applications. You can also use a permission to limit the external entities that can invoke the activity (see the permission attribute).


当您使用intent-filter满足activity的{​​{1}}时,可以打开intent-filter


要完全限制您的活动以供其他应用程序使用

<强> 1 activity

2。 Don't include any intent-filter