0

I am working on a mobile device management project. I need location updates to be fetched regularly. No matter if the app is closed or the phone is restarted, I need location updates all the time.

Can someone give me the code or logic for Background mode, App Terminated or phone restarted in swift?

Manoj Kumar
  • 318
  • 4
  • 14
  • if app is terminated then you wont be able to get location. so in short for getting location at least your app have to in background mode. – Nitin Gohel Jun 24 '16 at 06:13
  • http://stackoverflow.com/questions/30396367/getting-location-for-an-ios-app-when-it-is-in-the-background-and-even-killed. It is possible in Objective C. Please let me know if the same can be converted to Swift.. – Manoj Kumar Jun 24 '16 at 06:16
  • 1
    read its answer: `To get a location in the background, use the following code. It will make your app run in the background for a long time by restarting the background task everytime.` app must be in bg – Nitin Gohel Jun 24 '16 at 06:17
  • Will it work if App is phone is restarted and if App is never opened? – Manoj Kumar Jun 24 '16 at 06:23
  • do you understand what is the meaning of backgroundTask.? for the interaction with application app at-least in background mode if you terminated then you can not do anything with app functionality. For the restart location update you must be open your app once and do not terminat – Nitin Gohel Jun 24 '16 at 06:24
  • If you don't know something, please don't reply here. If App is terminated there are ways to get the location updates. And there are few stackoverflow answers for the same. My question was if I can get the same code in Swift. And will it work if phone is restarted. MobileIron is doing the same if the app is terminated. Please have some knowledge before answering here.. – Manoj Kumar Jun 24 '16 at 06:32
  • If you are using MDM then your server can send a push message to the device to force a checkin – Paulw11 Jun 24 '16 at 06:59
  • I have answered a similar question before but it was in objective C. If you would follow the setup of the project and I m sure you will get the relevant code and understand the process in a better way as to how it is happening. [Here](http://stackoverflow.com/a/32393452/3755838) is the link. Hope this helps you. – Saheb Roy Jun 24 '16 at 06:17

0 Answers0