PassiveListenerService
public abstract class PassiveListenerService extends Service
| java.lang.Object | ||||
| ↳ | android.content.Context | |||
| ↳ | android.content.ContextWrapper | |||
| ↳ | android.app.Service | |||
| ↳ | androidx.health.services.client.PassiveListenerService |
Service that enables receiving passive monitoring updates throughout the day when the app may not be running.
Health Services will bind to the PassiveListenerService to deliver passive monitoring updates such as data or goal updates. Clients should extend this service and override those methods of the PassiveListenerCallback that they care about. They can then pass in their service to PassiveMonitoringClient.setPassiveListenerServiceAsync to receive data updates.
Summary
Public constructors |
|---|
Public methods |
|
|---|---|
final IBinder |
|
void |
onGoalCompleted(@NonNull PassiveGoal goal)Called when a |
void |
onHealthEventReceived(@NonNull HealthEvent event)Called when a |
void |
onNewDataPointsReceived(@NonNull DataPointContainer dataPoints)Called when new |
void |
Called when the client has lost permission for the passive listener request. |
void |
Called when new |
Public constructors
Public methods
onGoalCompleted
public void onGoalCompleted(@NonNull PassiveGoal goal)
Called when a PassiveGoal has been completed.
| Parameters | |
|---|---|
@NonNull PassiveGoal goal |
the |
onHealthEventReceived
public void onHealthEventReceived(@NonNull HealthEvent event)
Called when a HealthEvent has been detected.
| Parameters | |
|---|---|
@NonNull HealthEvent event |
the |
onNewDataPointsReceived
public void onNewDataPointsReceived(@NonNull DataPointContainer dataPoints)
Called when new DataPoints are generated.
| Parameters | |
|---|---|
@NonNull DataPointContainer dataPoints |
a list of new |
onPermissionLost
public void onPermissionLost()
Called when the client has lost permission for the passive listener request. If this happens, WHS will automatically unregister the client request and stop the relevant sensors. The client can use this callback to detect the problem and either prompt the user to re-grant the permissions or re-register while requesting only that which the app does have permission for.
onUserActivityInfoReceived
public void onUserActivityInfoReceived(@NonNull UserActivityInfo info)
Called when new UserActivityInfo is generated.
| Parameters | |
|---|---|
@NonNull UserActivityInfo info |
a new |