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.

Share this article:

This article is from the free online course:

Secure Android App Development

University of Southampton