Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I prevent other android apps from accessing my activities

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.

like image 601
Dominic Avatar asked Jun 23 '11 21:06

Dominic


People also ask

How do I block 3rd party apps on Android?

Go to the Security section of your Google Account. Under “Third-party apps with account access,” select Manage third-party access. Select the app or service you want to remove. Select Remove Access.

Can an app access data from another app?

Just as an app can send data to other apps, it can also receive data from other apps as well. Think about how users interact with your application and what data types you want to receive from other applications.

Can I restrict Android app permissions?

To restrict a permission, tap the permission in the list – its status will change to Disabled. The permission won't actually be disabled until you restart your device, however. You can restart by tapping the menu button and tapping Reboot, or by shutting down and powering on your device normally.


1 Answers

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>
like image 136
mah Avatar answered Sep 20 '22 08:09

mah