# AppLaunchChecker

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/app/AppLaunchChecker.java+class:androidx.core.app.AppLaunchChecker) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***


```
public class AppLaunchChecker
```

<br />

*** ** * ** ***

This class provides APIs for determining how an app has been launched. This can be useful if you want to confirm that a user has launched your app through its front door activity from their launcher/home screen, rather than just if the app has been opened in the past in order to view a link, open a document or perform some other service for other apps on the device.

## Summary

| ### Public constructors |
|---|
| `[AppLaunchChecker](https://developer.android.com/reference/androidx/core/app/AppLaunchChecker#AppLaunchChecker())()` **This method is deprecated.** This type should not be instantiated as it contains only static methods. <br /> |

| ### Public methods |
|---|---|
| `static boolean` | `https://developer.android.com/reference/androidx/core/app/AppLaunchChecker#hasStartedFromLauncher(android.content.Context)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context)` Checks if this app has been launched by the user from their launcher or home screen since it was installed. |
| `static void` | `https://developer.android.com/reference/androidx/core/app/AppLaunchChecker#onActivityCreate(android.app.Activity)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/Activity.html activity)` Records the parameters of an activity's launch for later use by the other methods available on this class. |

## Public constructors

### AppLaunchChecker

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public [AppLaunchChecker](https://developer.android.com/reference/androidx/core/app/AppLaunchChecker#AppLaunchChecker())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> This type should not be instantiated as it contains only static methods.

## Public methods

### hasStartedFromLauncher

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static boolean hasStartedFromLauncher(@NonNull Context context)
```

Checks if this app has been launched by the user from their launcher or home screen since it was installed.

To track this state properly you must call `https://developer.android.com/reference/androidx/core/app/AppLaunchChecker#onActivityCreate(android.app.Activity)` in your launcher activity's `https://developer.android.com/reference/android/app/Activity.html#onCreate(android.os.Bundle)` method.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | Context to check |

| Returns |
|---|---|
| `boolean` | true if this app has been started by the user from the launcher at least once |

### onActivityCreate

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static void onActivityCreate(@NonNull Activity activity)
```

Records the parameters of an activity's launch for later use by the other methods available on this class.

Your app should call this method in your launcher activity's `https://developer.android.com/reference/android/app/Activity.html#onCreate(android.os.Bundle)` method to track launch state. If the app targets API 23 (Android 6.0 Marshmallow) or later, this state will be eligible for full data backup and may be restored to the user's device automatically.
\*

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/Activity.html activity` | the Activity currently running onCreate |