ios7 - CMMotionActivityManager - Receiving motion activity updates while app is suspended or in background -
i've been testing new motion activity manager apis (cmmotionactivitymanager
). want create app can receive , process motion updates startactivityupdatestoqueue
while app not running in foreground. correctly receive motion updates (stationary, walking, running, automotive, unknown) while app in foreground goes background (and gets suspended), motion updates cease received app.
cmmotionactivitymanager class reference: "this method initiates tracking of motion data asynchronously. upon calling method, motion activity manager executes handler block on specified queue, reporting current motion in effect device. after that, motion activity manager executes handler block when motion data changes. handler block executed on best effort basis , updates not delivered while app suspended. if updates arrived while app suspended, last update delivered app when resumes execution. of updates occurred while app suspended, use queryactivitystartingfromdate:todate:toqueue:withhandler:
method."
i want way keep app running in background , receive motion data (real-time). right way keep app running in background use background services "motion updates" not in list of allowed background services:
app store review guidelines: "multitasking apps may use background services intended purposes: voip, audio playback, location, task completion, local notifications, etc." don't want have location updates (gps) on time (to save battery). if bank on continuous location updates switch gps off, app suspended.
please let me know how keep app running in background , receive motion activity updates. there must way it: tried strava app....even when app in background, swithes gps off when user pauses running. when user resumes running, automatically turns gps on (all while app in background)...this means app running in background , actively receiving motion activity updates while gps off.
thank in advance!
this not new issue. there has never been core motion background usage setting. allowed use core motion if app running in background, make run in background have doing else (e.g. getting location updates @ time user sends app background, , have location
background service listed in info.plist.
note in ios 7 if have right hardware may able use deferred location updates wake app periodically in background. save power app gets run in background , without info.plist background service listing.
Comments
Post a Comment