Interface UsageStore

  • All Implemented Interfaces:
    java.io.Closeable , java.lang.AutoCloseable

    
    public interface UsageStore
     implements Closeable
                        

    Provides interface for the store object to persist the UsageRecord reported by all UsageReporters.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract void removeRecords(@NonNull() Date before, @NonNull() String targetId) Removes usage records from the store for the given target ID.
      abstract UsageSnapshot getSnapshot(@NonNull() Context context, @NonNull() String targetId) Retrieves an UsageSnapshot object for a given target ID.
      abstract void putRecord(@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 int getRecordCount() Retrieves the usage record count in the store from all target IDs.
      abstract String getStoreName() Retrieves the name of store
      • Methods inherited from class java.io.Closeable

        close
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • 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 records
        targetId - 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 context
        targetId - target ID associated with the usage snapshot
      • 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 stored
        targetId - target ID the usage record belongs to
      • getTargetIdentifiers

        @NonNull() abstract Array<String> getTargetIdentifiers()

        Retrieves an array of distinct target IDs in the store.

      • getRecordCount

         abstract int getRecordCount()

        Retrieves the usage record count in the store from all target IDs.

      • getStoreName

        @NonNull() abstract String getStoreName()

        Retrieves the name of store