Activity recognition API unreliable?

I am trying to use activity recognition in a project to determine when a user is "IN-VEHICLE". (Driving) The problem is that it is almost impossible to use it, since mostProbableActivity often reports "IN-VEHICLE" even though I sit at my desk for a long time or just walk around in my house. It would be very nice to know how the API does this.

I think this feature has great potential, but since something is clearly not working right now.

This is the MostProbableActivity magazine, done every 30 seconds to show what I mean. Sitting at my desk, after 4 minutes I rotate the phone a couple of times, and this leads to the result "mostProbable IN-VEHICLE".

I tried different phones, and the result is the same. Therefore, I do not think that this is related to equipment.

DetectedActivity [type=STILL, confidence=43] DetectedActivity [type=STILL, confidence=54] DetectedActivity [type=STILL, confidence=100] DetectedActivity [type=STILL, confidence=100] DetectedActivity [type=STILL, confidence=69] DetectedActivity [type=STILL, confidence=100] DetectedActivity [type=STILL, confidence=92] DetectedActivity [type=TILTING, confidence=100] DetectedActivity [type=IN_VEHICLE, confidence=49] DetectedActivity [type=TILTING, confidence=100] DetectedActivity [type=STILL, confidence=51] DetectedActivity [type=STILL, confidence=100] DetectedActivity [type=STILL, confidence=100] DetectedActivity [type=STILL, confidence=85] DetectedActivity [type=STILL, confidence=100] DetectedActivity [type=STILL, confidence=66] DetectedActivity [type=STILL, confidence=100] 

This is the code, nothing special:

 public class ActivitiesIntentService extends IntentService { private static final String TAG = "ActivitiesIntentService"; public ActivitiesIntentService() { super(TAG); } @Override protected void onHandleIntent(Intent intent) { ActivityRecognitionResult result = ActivityRecognitionResult.extractResult(intent); Intent i = new Intent(Constants.STRING_ACTION); DetectedActivity mostProbableActivity = result.getMostProbableActivity(); i.putExtra("MOST_PROBABLE_ACTIVITY",mostProbableActivity); LocalBroadcastManager.getInstance(this).sendBroadcast(i); Log.e(TAG, String.valueOf(mostProbableActivity)); } } 

From this link:

Activity Recognition API

I see that others have similar experiences, but some claim it works fine.

I think this is a mistake in the API trust algorithm. It is easy to conclude that the phone does not move in any direction or on the road, so it is clearly NOT the "mostProbable" in the VEHICLE.

Can anyone confirm this problem or use it incorrectly?

Best wishes

Thomas

+5
source share
2 answers

Remember that this is a very low power service, so it cannot constantly look at the sensors of the device. It drains the battery too quickly to be useful. Be sure to read the documents to understand the limitations.

If you need more accurate readings, increase the detection interval. This will provide more data to work with.

It should also be borne in mind that these measurements should be widely accepted. A possible use case is to estimate how long the deviceโ€™s media took physical activity, or to activate and deactivate application components that should be executed when the operator performs one of the detected actions.

+3
source

If you need more accurate readings, you should increase the detection level of your device, but this, in turn, will drain the battery. As for the answers of your results, to be sure that your user is performing a certain activity, trust in Google Play services should be> 75, or it would be safe to assume that your user is not performing it. In your case, the trust in Google Play services is 49, which means that he is not sure if your user is moving. You can also try using a simple "IF STATEMENT"

 if(DetectedActivity == "In_Vehicle" && result.getConfidence()> 75) { // output = User is Driving; // Perform task } 

Other ways to get more accurate information about the activities and locations of your users without running out of battery is to try some of the APIs, such as tranql, Context Hub, or Neura

+1
source

Source: https://habr.com/ru/post/1247151/


All Articles