0

i have lot of confusion now, can any one explain to me what is happening ?

first of all let me discuss about my app. i have an app which is running in the background continuously.I use location service for running app in the background mode, location service is just kept in background mode for infinite time, main task is different ,which works with timer in background mode. this app work fine till ios 7.0

Now problem is, i read that ios 7 and above there is some thing change when device going to "sleep mode" or may be "hibernet mode". i think app is going to suspend and also location service does not trigger.

I read some of the reference links for background mode and Location update also did R&D of some other link. After all of this i am going mad. I am confused that now that i need to Force run the app in background any how for all os. How do i do it?

Also this is a big problem because we do not understand why the behaviour is inconsistent between devices. i tested app in 5 device 2 ipad and one ipad Air and iphone 4s all have ios 7.1.1 and conclusion is in 3 device app's working fine but 2 device is stops to trigger my app in suspend mode

Do i need to change in location service ? Is there any way to running app continue in background ? How can i prevent to stop my apps while device is going to sleep mode ? or any thing new in default setting of the device ?

if i do pausesLocationUpdatesAutomatically = NO then will my app also running continuously in sleep mode ?

Please give me some suggestion or help - thanks.

Community
  • 1
  • 1
Bittu
  • 371
  • 4
  • 17
  • `[locationmanager stopUpdateLocation];` and also stop monitoring rigion so your location update stop.. – nitin kachhadiya May 09 '14 at 07:10
  • Look no further. Go to http://stackoverflow.com/questions/18946881/background-location-services-not-working-in-ios-7/21966662#21966662 and read my post. I have a blog post and also full solution posted on Github as well. There are over 30 comments on my blog post as well. Please update my post there if it helps you. Thanks. – Ricky May 09 '14 at 07:16
  • @nitinkachhadiya i dont need to stop update location. Question is for keep app in background for any how – Bittu May 09 '14 at 07:16
  • @voyage11 yes i show that but i can not understand what is use of [BackgroundTaskManager sharedBackgroundTaskManager] in you code ? – Bittu May 09 '14 at 07:18
  • @voyage11 i mean that you was use multi-task and start and stop location service. i am not getting about multi task – Bittu May 09 '14 at 07:20
  • set `UIBackgroundTaskIdentifier bgTask =0; UIApplication *app = [UIApplication sharedApplication]; bgTask = [app beginBackgroundTaskWithExpirationHandler: ^{ [app endBackgroundTask:bgTask]; }]; ` – nitin kachhadiya May 09 '14 at 07:21
  • set in application enter in background mode – nitin kachhadiya May 09 '14 at 07:21
  • @nitinkachhadiya my app working fine with below ios 7 and its work in background for infinite time, now problem come with ios 7 which was i write above – Bittu May 09 '14 at 07:24
  • If you download https://github.com/voyage11/Location and take a look, I have a backgroundTaskManager which manages all the background task. Some people report inconsistency as well. But I have tested my own with 2 live apps on the appstore, they are working quite well. But I do occasionally experienced some inconsistency. I have to collect more data to solve it as well. – Ricky May 09 '14 at 07:24
  • @voyage11 okey just one question if i will use your code and will not use backgroundTaskManager then will it work fine? – Bittu May 09 '14 at 07:27
  • 1
    in your app location start and stop in backgroud? – nitin kachhadiya May 09 '14 at 07:28
  • @Bittu if you stop location in background it's never start again in background – nitin kachhadiya May 09 '14 at 07:29
  • Using LocationManager to keep your app running in the background isn't _supposed_ to work. It's supposed to stop in the background to save battery life. If your app falls into one of the categories that allow background operations, use that. If not, why are you trying to run in the background? – gnasher729 May 09 '14 at 07:30
  • No. backgroundTaskManager is needed in order to manage those background tasks. Unless you figure out a better way to manage those tasks and I hope that you are willing to share. – Ricky May 09 '14 at 07:30
  • @voyage11 Okey i will try to use your code. but just one question before start to implementation. I used timer for do some of my task which is only work in backfround mode. so with your code should i need to change any thing with my code ? i mean i set timer in didFinihsLunch so can ikeep same place? right ? main purpose i only need app on BG – Bittu May 09 '14 at 07:44
  • The code on the Github is just a sample, you will have to change the code according to what you need. If the code and blog post help you, please upvote the post http://stackoverflow.com/questions/18946881/background-location-services-not-working-in-ios-7/21966662#21966662 Thanks. – Ricky May 09 '14 at 07:48
  • @voyage11 I alrady did it right now, thanks for positive advice. if i will get any query then free to come with you ? – Bittu May 09 '14 at 07:50
  • 1
    No problem. Thanks for that. Yes, you can ask me by posting comment on the blog or fill in the contact form on my blog, I am in touch with some other location based developers as well and we are collecting data to make the code better. – Ricky May 09 '14 at 07:53
  • @Ricky Yesterday we was talked for background app continue working. still i got same issue with your demo . after 20 – 25 min its can not work. when device going to sleep mode / hibernate mode. Please help me to do continue running app .my testing scenario is: open the app. put app to background lock the device for 20 to 25 min after 20 – 25 min app still going to suspend mode (i need to app in running mode ) – Bittu May 10 '14 at 07:50

0 Answers0