Skip to main content
Version: next

startActivity

The startActivity method launches an Android activity with the specified options and intent.

Signature

async startActivity(options: ActivityManager.StartActivityOptions): Promise<void>

Parameters

The StartActivityOptions interface includes the following properties:

PropertyTypeDescription
displayIdnumberSpecify which display to launch the activity on
windowingModenumberSpecify the windowing mode for the activity
forceStopbooleanForce stop the target app before starting the activity
userSingleUserTarget a specific user for the activity
intentIntentThe intent describing the activity to start (required)

Usage

await activityManager.startActivity({
intent: {
action: "android.intent.action.MAIN",
component: {
packageName: "com.android.settings",
className: "com.android.settings.Settings",
},
},
user: 0,
});

The method waits for the activity to start and returns when the process completes or throws an error if the activity fails to start.