public class TmdCloudApi
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_ALLOW_MOBILE_DATA |
Constructor and Description |
---|
TmdCloudApi() |
Modifier and Type | Method and Description |
---|---|
static Result<java.lang.Boolean> |
annotate(android.content.Context context,
long timestampStart,
long timestampEnd,
java.lang.String mode,
java.lang.String metadata)
Label an interval of time with a mode and metadata
This information will be forwarded to the cloud even if no corresponding data is available locally
|
static Result<TmdActivity> |
annotateActivity(android.content.Context context,
TmdActivity activity,
java.lang.String metadata)
Annotate the activity with new metadata
|
static Result<TmdActivity> |
correctActivity(android.content.Context context,
TmdActivity activity,
java.lang.String correctedLabel)
Correct the label of activity
|
static Result<java.util.List<TmdActivity>> |
fetchData(android.content.Context context,
java.util.Date date)
Fetch TMD activity data from the Moprim Cloud for the defined date
|
static Result<java.util.List<TmdActivity>> |
fetchData(android.content.Context context,
java.util.Date date,
boolean cacheOnly)
Fetch TMD activity data from the Moprim Cloud for the defined date
|
static Result<java.util.List<TmdActivity>> |
fetchData(android.content.Context context,
java.util.Date date,
int offsetMinutes)
Fetch TMD activity data from the Moprim Cloud for the defined date
|
static Result<java.util.List<TmdActivity>> |
fetchData(android.content.Context context,
java.util.Date date,
int offsetMinutes,
boolean cacheOnly)
Fetch TMD activity data from the Moprim Cloud for the defined date
|
static Result<java.util.List<TmdActivity>> |
fetchData(android.content.Context context,
long start,
long end)
Fetching data from the Moprim cloud
|
static Result<java.util.List<TmdActivity>> |
fetchData(android.content.Context context,
long start,
long end,
boolean cacheOnly)
Fetching data from the Moprim cloud
|
static Result<TmdCloudMetadata> |
fetchMetadata(android.content.Context context)
Fetch the metadata from the Cloud.
|
static Result<TmdCloudMetadata> |
fetchMetadata(android.content.Context context,
boolean cacheOnly)
Fetch the metadata from the Cloud.
|
static Result<java.util.List<TmdStats>> |
fetchStats(android.content.Context context,
int last)
Fetching stats from the Moprim cloud
|
static android.app.PendingIntent |
getCallbackIntent() |
static boolean |
isMobileDataAllowed(android.content.Context context) |
static void |
setCallbackIntent(android.app.PendingIntent intent)
Sets an callback intent for the background operation with the cloud.
|
static void |
setDefaultMobileDataAllowed(android.content.Context context,
boolean allowed)
This method should be called in the Application class to initialize the default use of mobile data for background data upload.
|
static void |
setMobileDataAllowed(android.content.Context context,
boolean mobileDataAllowed) |
static Result<TmdActivity> |
updateActivity(android.content.Context context,
TmdActivity activity,
java.lang.String correctedLabel,
java.lang.String metadata)
Update the activity with new metadata and a corrected label
|
static Result<TmdUploadMetadata> |
uploadData(android.content.Context context)
Upload the collected data to the cloud pro-actively
|
public static final boolean DEFAULT_ALLOW_MOBILE_DATA
public static void setCallbackIntent(android.app.PendingIntent intent)
intent
- the intent to be executedpublic static android.app.PendingIntent getCallbackIntent()
public static Result<java.util.List<TmdActivity>> fetchData(@NonNull android.content.Context context, @NonNull java.util.Date date)
context
- the contextdate
- the datepublic static Result<java.util.List<TmdActivity>> fetchData(@NonNull android.content.Context context, @NonNull java.util.Date date, int offsetMinutes)
context
- the contextdate
- the dateoffsetMinutes
- the number of minutes to offset for the date. It can be negativepublic static Result<java.util.List<TmdActivity>> fetchData(@NonNull android.content.Context context, @NonNull java.util.Date date, boolean cacheOnly)
context
- the contextdate
- the datecacheOnly
- set to true if you wish to use the cache onlypublic static Result<java.util.List<TmdActivity>> fetchData(@NonNull android.content.Context context, @NonNull java.util.Date date, int offsetMinutes, boolean cacheOnly)
context
- the contextdate
- the dateoffsetMinutes
- the number of minutes to add to start the datecacheOnly
- set to true if you wish to use the cache onlypublic static Result<java.util.List<TmdActivity>> fetchData(@NonNull android.content.Context context, long start, long end)
context
- the contextstart
- the start time (timestamp in ms)end
- the end time (timestamp in ms)public static Result<java.util.List<TmdActivity>> fetchData(@NonNull android.content.Context context, long start, long end, boolean cacheOnly)
context
- the contextstart
- the start time (timestamp in ms)end
- the end time (timestamp in ms)cacheOnly
- set to true if you wish not to request data from the cloudpublic static Result<java.util.List<TmdStats>> fetchStats(@NonNull android.content.Context context, int last)
context
- the contextlast
- the number of days for the last periodpublic static Result<TmdCloudMetadata> fetchMetadata(@NonNull android.content.Context context)
context
- the contextpublic static Result<TmdCloudMetadata> fetchMetadata(@NonNull android.content.Context context, boolean cacheOnly)
context
- the contextcacheOnly
- if true, only check the cachepublic static Result<TmdUploadMetadata> uploadData(@NonNull android.content.Context context)
context
- the context running the requestpublic static Result<TmdActivity> correctActivity(@NonNull android.content.Context context, TmdActivity activity, java.lang.String correctedLabel)
context
- the contextactivity
- the activity to correctcorrectedLabel
- the new labelpublic static Result<TmdActivity> annotateActivity(@NonNull android.content.Context context, TmdActivity activity, java.lang.String metadata)
context
- the contextactivity
- the activity to correctmetadata
- the metadatapublic static Result<TmdActivity> updateActivity(@NonNull android.content.Context context, TmdActivity activity, java.lang.String correctedLabel, java.lang.String metadata)
context
- the contextactivity
- the activity to correctcorrectedLabel
- the new labelmetadata
- the metadatapublic static Result<java.lang.Boolean> annotate(@NonNull android.content.Context context, long timestampStart, long timestampEnd, java.lang.String mode, java.lang.String metadata)
context
- the contexttimestampStart
- the start timestamp of the annotationtimestampEnd
- the end timestamp of the annotationmode
- the modemetadata
- the metadatapublic static boolean isMobileDataAllowed(@NonNull android.content.Context context)
public static void setMobileDataAllowed(@NonNull android.content.Context context, boolean mobileDataAllowed)
public static void setDefaultMobileDataAllowed(@NonNull android.content.Context context, boolean allowed)
context
- the context of the applicationallowed
- if the use of mobile data is allow by default or not