public class Tracking
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
START_TIME_KEY
Key for shared preferences to store a start time.
|
protected static java.lang.String |
USAGE_TIME_KEY
Key for shared preferences to store a usage time.
|
Constructor and Description |
---|
Tracking() |
Modifier and Type | Method and Description |
---|---|
protected static android.content.SharedPreferences |
getPreferences(android.content.Context context)
Helper method to return an instance of SharedPreferences.
|
static long |
getUsageTime(android.content.Context context)
Returns the usage time of the current version in seconds.
|
static void |
startUsage(android.app.Activity activity)
Starts tracking of the usage time for the given activity.
|
static void |
stopUsage(android.app.Activity activity)
Stops tracking of the usage time for the given activity.
|
protected static final java.lang.String START_TIME_KEY
protected static final java.lang.String USAGE_TIME_KEY
public static void startUsage(android.app.Activity activity)
activity
- Instance of activitypublic static void stopUsage(android.app.Activity activity)
activity
- Instance of activitypublic static long getUsageTime(android.content.Context context)
context
- Context to access shared preference.protected static android.content.SharedPreferences getPreferences(android.content.Context context)
context
- Context to access shared preference.