Android Question Activity Recognition service

Rusty

Well-Known Member
Licensed User
Longtime User
Can one create a service that starts at boot and causes/receives AR events?
i.e. A stand alone service (like a widget) that invokes the Activity Recognition and then the creating service also receives the events
Thanks,
Rusty
 

Rusty

Well-Known Member
Licensed User
Longtime User
Thanks Erel,
I'm not clear on what you meant.
I'd like to create a service that starts at boot and receives Activity Recognition events.
I've created an activity that starts the service (like a widget might) and then Activity.finish. It appears the events still fire, even though the activity is not visible.
Can this work reliably? In time, will the Activity Finish ultimately kill all processes?
Also, what is the minimum interval for Activity Recognition?
I discovered GetMostProbableActivity which has a bunch of useful information/methods https://developers.google.com/andro...ognitionResult.html#getMostProbableActivity()
on the GOOGLE api. Do we have access to this?
Rusty
 
Last edited:
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
Any chance we can get "getMOSTProbableActivity" and methods?
https://developers.google.com/andro...ognitionResult.html#getMostProbableActivity()

My problem is the AR doesn't fire for many seconds after an event starts/stops. This causes (obviously), the false reporting of the activity times.
For example:

I'm trying to find an accurate way to find when an activity changes (i.e. from still to on-foot/walking/running) such that i can properly identify those activity start and stop times (duration).
Thanks,
Rusty
 
Last edited:
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
Thanks Erel,
Ok, since this won't work, can you advise how one can determine when one activity ends and the next starts, repetitively?
i.e. Still begins when the service starts (assumed default); X amount of time elapses and then walking begins, HOWEVER, it might be as much as 30 seconds or more before the AR fires to let you know something has happened. Therefore you have no way of knowing when still stopped and walking began, ergo one can't accurately detect how long (in this example) walking occurred.
Rusty
 
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
yes on both accounts.
The results I'm getting have both and still, even while NOT sleeping, it will i.e. report still, I'll start running/walking, it'll be 30+- seconds before it reports the phone activity has changed, even if I run/walk for only a few seconds during this period.

time line
still........walk.....10 seconds.....stop walking........30 seconds or so......walk fires
Any other ideas?
Rusty
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…