User Activity Recognition

Hi Team, help me out to know,, is it possible to get user activity status , even when app is TERMINATED or SUSPENDED.

NOTE: as of now, i can track user activity , when app is in background

  • i want to get activity , even when app is TERMINATED BY USER.

thanks in advance, help me out.

Replies

With your activityManager (CMMotionActivityManager instance in your Data Model) do a query when an app is restarted ref https://developer.apple.com/documentation/coremotion/cmmotionactivitymanager/1615929-queryactivitystarting HOWEVER, only the last 7 days of activity are available - and you'd need to know when the app was terminated or suspended so as not to double count. It might also be possible to schedule a batch background task (e.g. at night) to run the query and place results in permanent data storage. Check out this reference https://developer.apple.com/documentation/backgroundtasks/choosing_background_strategies_for_your_app particularly"Wake Your App with a Background Push". I've never done this, only knowing about it from the documentation.

Good luck and regards, Michaela