我有一个Android应用程序中,我在清单中定义多个不同的活动。其中一些活动有意向的过滤器,我使用(如ACTION_PICK)。这些活动是因为意向过滤器,显示当其他应用程序请求的活动来处理ACTION_PICK。有没有一些方法,以prevent这一点,所以,我的活动,不能访问其他应用程序?我已经尝试设置的android:在我的活动远销=假,但没有采取任何行动。
I have an android app in which I define several different activities in the manifest. Some of these activities have intent-filters that I use (such as ACTION_PICK). These activities, because of the intent-filters, show up when other applications request an activity to handle an ACTION_PICK. Is there some way to prevent this, so that my activities are not accessible to other applications? I've already tried setting android:exported="false" in my activity, but that did nothing.
您需要: *定义权限(这仅适用于具有签名的应用程序) *定义您的应用程序使用您定义的权限 *要求准许你想保护的活动。 (注意不要需要为您的主要推出的活动)。
You need to: * define a permission (which is only available to applications having your signature) * define that your application uses your defined permission * require that permission for the activities you want protected. (Be careful to not require it for your main launch activity).
<!-- define a permission -->
<permission
android:protectionLevel="signature"
android:name="com.mypackage.MYPERMISSION"/>
<uses-permission android:name="com.mypackage.MYPERMISSION" />
<!-- define an activity which can only be started through internal code -->
<activity android:name="..."
android:permission="com.mypackage.MYPERMISSION" >
...
</activity>