Victor G
Victor G

Reputation: 399

Improve Activity Recognition API, filtering false positives

Activity Recognition may throw quite a few false positives as you, no matter how high you raise the confidence level. So if, for example, I would like to throw a notification when the user is driving I would need build some sort of state machine.

For example:

When I get IN_VEHICLE updates with CONFIDENCE > 70 for 30 seconds, I send a notification

or

When I get 3 consecutive IN_VEHICLE updates with CONFIDENCE > 70, I send a notification

There are different issues when implementing it though. Sometimes you get very frequent updates (2nd fails) or you vet very rare updates (1st fails).

How do go about designing this so that you have smoother transitions between states?

Upvotes: 3

Views: 614

Answers (1)

Teyam
Teyam

Reputation: 8082

I think this tutorial - How to Recognize User Activity With Activity Recognition will help you. And, as mentioned in the tutorial, making your application context-aware is one of the best ways to offer useful services to your users.

In Handling Activity Recognition:

In the onHandleIntent() method of ActivityRecognizedService, the first thing you do is validate that the received Intent contains activity recognition data. If it does, then you can extract the ActivityRecognitionResult from the Intent to see what activities your user might be performing. You can retrieve a list of the possible activities by calling getProbableActivities() on the ActivityRecognitionResult object.

Source files used can be found in GitHub - Android-ActivityRecognition.

Upvotes: 1

Related Questions