ActivityCompat

public interface ActivityCompat

This interface is deprecated.
Starting December 2025, Instant Apps cannot be published through Google Play, and all Google Play services Instant APIs will no longer work. To continue optimizing for user growth, we encourage developers to refer users to their regular app or game, and using deeplinks to redirect them to specific journeys or features when relevant.

A helper for accessing features in Activity in a backwards compatible fashion. Construct this by using InstantApps.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