Ad

How Continue Doing IOS Location Tracking Even After The App Is Killed?

I am having an issue trying to have an ongoing location tracking enabled when the following conditions are in place:

  • Background fetch is disabled
  • App is killed

When the above happens, location updates are stopped. I tried to have my server send push notifications to wake the app up but they do not arrive if the app is killed.

What is puzzling is that a similar functionality seems to work just fine on WhatsApp (the live location). On WhatsApp, even if I disable background fetch and kill the app, it somehow manages to wake it up again to send updated location information.

Does anyone have any idea on what they are doing?

Ad

Answer

It seems WhatsApp could be using PushKit to get around this problem. According to this question:

WhatsApp could be using VOIP background mode along with PushKit for solving this problem.

Voip pushes are:

  • delivered directly to the app.
  • considered high-priority notifications and are delivered without delay.
  • delivered even if the app was force-quit by the user.

I have also created a quick sample app to try this and it works like a charm. However, again according to the question linked, Apple doesn't really allow this solution:

Apple no longer allows the usage of the API for push notifications of non-VOIP apps. They do however allow WhatsApp to do it in their infinite fairness.

Ad
source: stackoverflow.com
Ad