Interface UsageStore
-
- All Implemented Interfaces:
-
java.io.Closeable,java.lang.AutoCloseable
public interface UsageStore implements CloseableProvides interface for the store object to persist the UsageRecord reported by all UsageReporters.
-
-
Method Summary
Modifier and Type Method Description abstract voidremoveRecords(@NonNull() Date before, @NonNull() String targetId)Removes usage records from the store for the given target ID. abstract UsageSnapshotgetSnapshot(@NonNull() Context context, @NonNull() String targetId)Retrieves an UsageSnapshot object for a given target ID. abstract voidputRecord(@NonNull() UsageRecord record, @NonNull() String targetId)Stores an Usage Record against the given target ID. abstract Array<String>getTargetIdentifiers()Retrieves an array of distinct target IDs in the store. abstract intgetRecordCount()Retrieves the usage record count in the store from all target IDs. abstract StringgetStoreName()Retrieves the name of store -
-
Method Detail
-
removeRecords
abstract void removeRecords(@NonNull() Date before, @NonNull() String targetId)
Removes usage records from the store for the given target ID. that are older than the given cut off date.
- Parameters:
before- cut-off date for cleaning up usage recordstargetId- target ID for which the clean-up is done
-
getSnapshot
@NonNull() abstract UsageSnapshot getSnapshot(@NonNull() Context context, @NonNull() String targetId)
Retrieves an UsageSnapshot object for a given target ID.
- Parameters:
context- Android application contexttargetId- target ID associated with the usage snapshot- Returns:
UsageSnapshot object for the given targetID.
-
putRecord
abstract void putRecord(@NonNull() UsageRecord record, @NonNull() String targetId)
Stores an Usage Record against the given target ID.
- Parameters:
record- usage record to be storedtargetId- target ID the usage record belongs to
-
getTargetIdentifiers
@NonNull() abstract Array<String> getTargetIdentifiers()
Retrieves an array of distinct target IDs in the store.
- Returns:
An array of target IDs.
-
getRecordCount
abstract int getRecordCount()
Retrieves the usage record count in the store from all target IDs.
- Returns:
Count of records in the store from all target IDs.
-
getStoreName
@NonNull() abstract String getStoreName()
Retrieves the name of store
- Returns:
Name of the store
-
-
-
-