I'm wondering, why ActivityRecognitionClient has no method to request updates with standard java listener as parameter? More strange, that in the same time, LocationСlient has such method and it works good.
Official example for Activity Recognition looks terrible. A lot of coupled and boilerplate code. It looks like IntentService is sole variant for handling updates from ActivityRecognitionClient. It's extremely uncomfortable.
@Guys from Android Team, why it happens?
As Developer I hope to see requestActivityUpdates(interval, listener) method in next version of Google Play Services.
For now, does anyone know, is it possible to use BroadcastReceiver for handling updates from ActivityRecognitionClient?
I'm wondering, why ActivityRecognitionClient has no method to request updates with standard java listener as parameter?
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.
Beyond that, quoting the documentation for requestActivityUpdates()
:
A common use case is that an application wants to monitor activities in the background and perform an action when a specific activity is detected. To do this without needing a service that is always on in the background consuming resources, detected activities are delivered via an intent. The application specifies a PendingIntent callback (typically an IntentService) which will be called when activities are detected.
It looks like IntentService is sole variant for handling updates from ActivityRecognitionClient.
It's not.
For now, does anyone know, is it possible to use BroadcastReceiver for handling updates from ActivityRecognitionClient?
There are several types of PendingIntent
, created from various factory methods. The sample shows using getService()
to create a PendingIntent
that will call startService()
. You are welcome to use any other PendingIntent
, such as one from getBroadcast()
, which will call sendBroadcast()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With