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
public DetectedActivity getMostProbableActivity ()

Returns the most probable activity of the user.

List < DetectedActivity > getProbableActivities ()[/paste:font]

Returns the list of activities that where detected with the confidence value associated with each activity. The activities are sorted by most probable activity first.
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:
** Service (recognitionservice) Start **
still ms of data: 4004 stop: 1475622257646 start time: 1475622253642
17:04:17 CurrDt: 2016-10-04 updating still plus new 0.07 --- 4004ms
17:04:17>>-> 2016-10-04
... 28 seconds elapse with NO fire of activity, even though I walked/ran for about 5 seconds
17:04:45>>-> 2016-10-04
** Service (recognitionservice) Start ** Finally it fires
running 1475621817736 NEW activity it sees that I was running 28 seconds after I start running. I only ran for about 4 - 5 seconds
unknown 0
17:04:48>>-> 2016-10-04
still ms of data: 31022 stop: 1475622288668 start time: 1475622257646
17:04:48 CurrDt: 2016-10-04 updating still plus new 0.52 --- 31022ms

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
Top