Ecarrion Ecarrion - 3 years ago 132
iOS Question

Pedometer in the Background

I know this has been asked 1 million times but it has been just impossible to figure it out for me.

So I need to build a pedometer app and have it continuing counting steps event if they send the app to de background for more than 10 minutes.

The client wants not use use GPS at all, an also not play a silent audio because Apple may reject it.

Does anyone one have and idea on how to do this?

The client is taking Runtastic Pedometer app as Reference and I have been analysing it and it doesn't use nor Location, nor music and runs in the background for more than 10 minutes.

Any clue? is it really imposible to do it this way? could be possible that Runtastic people made an agree with apple to use some secret API to have it running in the background?

Answer Source

I looked at Runtastic Pedometer and it has the following in its Info.plist file:


So basically, they do the audio trick, and they claim some tie-in with an external accessory.

I hate to state the obvious, but your question appears to be "These are the rules, but I don't want to follow them. How do I get around them?" The answer appears to be: "Add features to your app until you meet one of the criteria." From the docs:

In iOS, only specific app types are allowed to run in the background:

  • Apps that play audible content to the user while in the background, such as a music player app
  • Apps that keep users informed of their location at all times, such as a navigation app
  • Apps that support Voice over Internet Protocol (VoIP)
  • Newsstand apps that need to download and process new content
  • Apps that receive regular updates from external accessories

So add one of those features to your app. Add a setting to play a congratulatory noise after every mile walked. Leave it off by default. That should qualify you for the audio-playing exemption. Have an option to capture location data to mark where the user was when they crossed 1,000 miles walked. Leave the feature off by default. That should qualify for the location criteria. Add a feature to download inspirational Haiku from an RSS feed, or headlines from That might get you in on the new-content reason. It's not hard. Just come up with some trivial, ten-lines-of-code feature that gets you in the door. Use your imagination.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download