Pedometer in the background

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

So, I need to create an application for the pedometer and continue counting steps if they send the application to the background image for more than 10 minutes.

The client does not want to use GPS at all, and also does not play sound without sound, because Apple may reject it.

Does anyone have any ideas on how to do this?

The client accepts the Runtastic Pedometer application as a reference, and I analyzed it, and it does not use either space or music, but works in the background for more than 10 minutes.

Any clue? Is it really impossible to do so? Is it possible that the Runtastic people agreed with the apple to use some kind of secret API to make it work in the background?

+7
ios objective-c background accelerometer
source share
3 answers

I looked at the Rammastic Pedometer, and in the Info.plist file it has the following:

 <key>UIBackgroundModes</key> <array> <string>audio</string> <string>external-accessory</string> </array> 

So basically, they do an audio trick, and they require some binding with an external accessory.

I hate to state the obvious, but your question is: "These are the rules, but I do not want to follow them. How can I get around them?" The answer is as follows: "Add features to your application until you find one of the criteria." From the docs:

On iOS, only certain types of applications are allowed to run in the background:

  • Applications that play audio content for the user in the background, for example, an application for a music player.
  • Applications that inform users of their location at any time, such as a navigation application
  • Applications that support Voice over Internet Protocol (VoIP)
  • Press applications to download and process new content.
  • Applications regularly receiving updates from external accessories

So, add one of these features to your application. Add a setting to play a congratulatory noise after every mile. Leave this at default. This should qualify you for exemption from the audio stream. You have the opportunity to capture location data to mark where the user was when they crossed 1000 miles. By default, the function is disabled. This must match the location criteria. Add a feature to download inspiring Haiku from an RSS feed or headlines from runnersworld.com. This may lead you to a new reason. It's not hard. Just come up with some trivial function with ten lines of code that takes you to the door. Use your imagination.

+20
source share

You can check Apple Docs for announcing your supported background task apps. You can also check out this tutorial about using background modes.

+1
source share

If you have a server side, you can not run your application in the background by themselves, sending a quiet push and waking up your application only to report the number of steps.

You can register for silent clicks without forcing the user to confirm receipt of push messages, since they do not see them.

0
source share

All Articles