3.17

# Securing Activities

Activities are started by calling startActivity() (or startActivityForResult() if a result is expected) with either an explicit or an implicit Intent.

To control which apps can start an Activity, add the appropriate permission using the android:permission attribute of the <activity> element in the app’s AndroidManifest.xml file.

<manifest …>
<application …>
<activity android:name="com.example.myamazingapp.SomeActivity"
android:permission="com.example.myamazingapp.SOME_PERMISSION">
<intent-filter>
…
</intent-filter>
</activity>
</application>
</manifest>


Only apps that have requested (and been granted) that permission will then be able to start the Activity.