6

I am wondering how I can keep receiving motion sensor values while the app is in background mode. I realize that there are already several posts out there. For example, I have tried How Nike+ GPS on iPhone receives accelerometer updates in the background? which does not work for me.

I have also enabled background modes (location updates at the moment) in my App-Info.plist.

Are there any working examples out there? Also, if possible, I would not want to implement some of the hacks, e.g. play silent audio or get the user's location. Apps such as SleepCycle seem to be able to have achieved this without any workarounds.

I'd be grateful for any help.

Community
  • 1
  • 1
davhab
  • 805
  • 2
  • 9
  • 17
  • 1
    In what way does http://stackoverflow.com/questions/8716466/how-nike-gps-on-iphone-receives-accelerometer-updates-in-the-background not work for you? It is the appropriate answer... – Wain Mar 17 '14 at 16:32
  • Should I call the proposed code in my AppDelegate's applicationDidEnterBackground? I am already storing the sensor values while the app is active. I would like to *keep* receiving values when the phone goes into background mode, without interruption. – davhab Mar 17 '14 at 16:50
  • Why would you need that? Why not receive a bulk of data when the app is reopened? – Wain Mar 17 '14 at 18:04
  • The proposed solution only runs for around 3 minutes in the background and then stops recording. Would you have any suggestions on how I can let it run forever (until the user activates the app again and stops it manually)? – davhab Mar 19 '14 at 14:09
  • 1
    Did you set the location background mode? – Wain Mar 19 '14 at 14:12
  • Thanks for the suggestion @Wain, I have enabled Audio & AirPlay, Location and VoIP background modes. Still, after 3 minutes, the device stops receiving accelerometer values. Any other ideas? – davhab Mar 19 '14 at 14:28
  • I have the same issue like dh00608000. Does somebody have experience with the "Audio trick" like RunKeeper is using? I only need the data of user, running/walking/automotive and in certain status activate the gps, all in background. Searching for this solution for ages now – verklixt Aug 14 '14 at 10:32

0 Answers0