QA
This is the main element one needs to use to access all the functionality of the QA SDK. As a singleton it can be called easily from anywhere in the code and gives access to all the possible interactions with the QA backend, as well as some functions to retrieve user metrics. Since most of the calls are asynchronous server interactions, they return flows.
Author
Types
This internal class holds the string that identify the flags for requesting the number of taps in a certain period with QA.getLastTaps
Functions
Use this function to delete a journal entry. You need to provide the id of the entry you want to delete, checkout journalEntries and JournalEntry to see how to retrieve the id of the entry to delete.
Retrieves the list of studies the device is currently registered for.
Use this function to retrieve a particular journal entry. You need to provide the id of the entry you want to retrieve, checkout journalEntries and JournalEntry to see how to retrieve the id of the entry.
This functions returns a fictitious journal and can be used for test/display purposes, Checkout JournalEntry for a complete description of how the journal entries are organized.
Retrieves taps in the last day, week or month depending on the provided flag. Please also QATaps shows the provided result structure. Alpha feature, try setting flag as the number of days you would like to gat back.
Get a QA metric or trend relative to the device in use. Check the the list of available metrics from Metric and Trend. The function returns an object of type TimeSeries which contains timestamps and values of the requested metric. The call is asynchronous ans returns a flow.
Get a QA metric relative to a fictitious test device. Check the the list of available metrics from Metric. The function returns an object of type TimeSeries which contains timestamps and values of the requested metric. The call is asynchronous ans returns a flow. You can use this function to test your data workflow and visualization.
Get a list of all the questionnaires available to complete (across all the studies to which a device is subscribed to).
The first time you use the QA SDK in the code you should initialize it, this allows the SDK to create a unique identifier and initiate server transactions and workflows. Most of the functionality will not work if you have never initialized the singleton before. The function is synchronous and return a flow with the status of the registration of the device to the server. NOTE: do not use this function without collecting the flow otherwise the function will not be called at all.
This function check that the data collection is currently running.
This function checks if the device is already registered to the QA backend.
This functions returns the full journal of the device, meaning all entries with the corresponding events. Checkout JournalEntry for a complete description of how the journal entries are organized.
Retrieves the Journal events, meaning the events that one can log together with a journal entry. The events come from a fixed set which may be updated in the future, this function return the latest update to the JournalEventEntity.
Use this to withdraw the device from a particular cohort.
Pause the data collection.
This function checks if the overlay permission has been granted, if not opens the corresponding settings activity to prompt the user to grant this permission.
This function checks if the usage permission has been granted, if not open the corresponding settings activity to prompt the user to grant this permission.
Use this to re-subscribe the user to a cohort from which they were withdrawn.
Restart the data collection after it has been purposely paused.
Some manufacturers kill apps that are running for too long, on those devices it is better to ask the user to prevent the OS from killing the app running this SDK. Call this function to retrieve the Intent that redirects the user to the correct setting for disabling battery optimization of the current manufacturer. The functions returns a list, choose the first intent, in an empty list is returned, the current manufacturer does not have specific battery optimization options, thus the request is not needed and the SDk should run safely.
Use this utility function to create or edit a journal entry. In case you want to edit a note you will need to pass the ID of the entity to edit. The function returns an asynchronous flow with the response of the action. The response is mostly to trigger UI/UX events, in case of failure the SDK will take care internally of retrying.
Use this function to update the basic info of a user. You can call the function with one or parameters, the missing ones will be considered unaltered.