public class AppLaunchChecker extends Object
Constructor and Description |
---|
AppLaunchChecker() |
Modifier and Type | Method and Description |
---|---|
static boolean |
hasStartedFromLauncher(Context context)
Checks if this app has been launched by the user from their launcher or home screen
since it was installed.
|
static void |
onActivityCreate(Activity activity)
Records the parameters of an activity's launch for later use by the other
methods available on this class.
|
public static boolean hasStartedFromLauncher(Context context)
To track this state properly you must call onActivityCreate(Activity)
in your launcher activity's Activity.onCreate(Bundle)
method.
context
- Context to checkpublic static void onActivityCreate(Activity activity)
Your app should call this method in your launcher activity's
Activity.onCreate(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.
activity
- the Activity currently running onCreate