3

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?

Nikola Despotoski
  • 49,966
  • 15
  • 119
  • 148
Victor G
  • 399
  • 2
  • 12

1 Answers1

1

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.

Teyam
  • 7,686
  • 3
  • 15
  • 22
  • Teyam, thanks for your answer but I think you missed the question. During different movements you can do, like walking, the api is tricked to report that you are in vehicle, for a short period of time, and then it recognizes that you are walking again. You need to implement extra filters and logic on top of the basic setup which your link covers. – Victor G Jun 18 '16 at 11:56