Google is committed to advancing racial equity for Black communities. See how.

ActivityCompat

public interface ActivityCompat

A helper for accessing features in Activity in a backwards compatible fashion. Construct this by using getActivityCompat(Activity).

This helper augments the included methods with data on instant apps.

Public Method Summary

abstract ComponentName
getCallingActivity()
Gets the ComponentName of the activity that launched the intent to start this activity.
abstract String
getCallingPackage()
Gets the package name of the app that launched the intent to start this activity.

Public Methods

public abstract ComponentName getCallingActivity ()

Gets the ComponentName of the activity that launched the intent to start this activity. This may be an activity in an installed app or an instant app.

Returns
  • the component name of the activity that started the activity, or null

public abstract String getCallingPackage ()

Gets the package name of the app that launched the intent to start this activity. This may be the package name of an installed app or an instant app.

Returns
  • the package name of the app that started this activity, or null