SpringBoard[48] <Warning>: High Priority Push: [Bundle ID] - BAR Disabled - ios

Problem
Sending silent notifications for release app version shows next log:
SpringBoard[48] <Warning>: High Priority Push: [Bundle ID] - BAR Disabled
Any idea? BAR Disabled??
Looks like when "BAR Disabled" log appears, the method (didReceiveRemoteNotification - fetchCompletionHandler) is not being called.
More info
BAR Disabled Log appears in production app in tested iphone 4s and iphone6
BAR Disabled Log is not appearing in tested iPhone5, and fetchCompletionHandler is called.
BAR Disabled Log is not appearing while debugging.
BAR Disabled Log appears with param "content-available":1
Tested with swift and objective-c
Tested with Distribution profile(testflight) & adhoc profile(itunes)
iOS version 9.3.1
Notification
{"aps":{"alert":"Test","sound":"default","content-available":1}, "data" : 345}
Result
Displays notification with text "Test" and plays default sound but fetchCompletionHandler is not being called, just a log:
SpringBoard[48] <Warning>: High Priority Push: [Bundle ID] - BAR Disabled

BAR Disabled means that Background App Refresh is not enabled so app is not able to perform fetchCompletionHandler.
From device go to Settings > General > Background App Refresh and turn on Background App Refresh.
If you quit an app from the app switcher, it might not be able to run or check for new content before you open it again.
More Info about Background App Refresh (BAR):
This is a whole other thing that works outside of the 10 minutes grace period. An app with BAR enabled is allowed to wake up every now and then until it's quit from the app switcher or the phone resprings/reboots. There is no 10 minute restriction here, and it's important to understand that BAR is different from backgrounding. By "wakes up" I mean "opens a sleepy eye and downloads some stuff, then goes straight back to sleep". If you kill the app from the app switcher, its BAR privilege is gone as well.
BAR-enabled apps are usually scheduled to wake up at opportune moments to update themselves. These moments include:
when the device is actively in use
when the device is connected to wifi and/or a power source
when a push notification for the app is received
when location changes
From Apple themselves: iOS learns patterns based on your use of the device and tries to predict when an app should be BAR-updated in the background. It also learns when the device is typically inactive, such as during the night, to reduce update frequency when the device is not in use.
Thanks to the information shared by /u/Niruga, there is also what is called a "silent" push notification that apps can make use of to wake their app up for BAR-updates. Silent push notifications are not seen by the user.
For example, Dropbox makes use of BAR and location to keep its photo upload working past 10 minutes for as long as it takes to finish uploading. It won't be constantly uploading, since that's not what BAR does. So what's happening in Dropbox is that it uses location changes to make the app wake up and upload for 10 minutes before it goes to back to sleep, then waits for the next location change to make the app wake up again and continue where it left off, and repeat until all uploading is done, all without the user having to keep the app open in the foreground.
To decide whether or not to enable BAR, think about whether you trust the app developers not to abuse the function.
Hope it helps.
ref: https://www.reddit.com/r/jailbreak/comments/3eao32/discussion_write_up_ios_backgrounding_and/

Related

Questions about app state after tapping on app icon after apps enters suspended state

I’m putting an app into background.
Assuming that I’m not doing anything to keep the app alive in the background, then the app goes through suspended state in a matter of 5 seconds. Right?
What happens if I then tap on the app icon? That’s not suppose to trigger a didFinishLaunch right? It will just bring me back to the last screen I was at and also trigger didbecomeActive & willenterforeground notifications. I won't be getting any other callback. Right?
Assuming there is no restart of the phone, point 2 is true even if there are hours between me tapping home and then tapping back the app icon. Right? Does it also persist device restarts but not force-restart?
The only time I won’t be brought back to the screen I was at (before hitting home) is if the device receives a memory warning and my app is flushed out of suspended state. At this point tapping on the app icon will result in didFinishLaunch. Right?
(I’m asking all of this because sometimes after putting the app in the background and tapping the app icon again (e.g. 10 minutes later), the app is going through it’s launch phase. Most of the time it just goes back to its previous screen)
I've already seen Will ios terminate the app running in background after a specific time? but that doesn't address all aspects I want.
It will just bring me back to the last screen I was at and also trigger didbecomeActive & willenterforeground notifications.
Right, if your app was not terminated in the background.
I won't be getting any other callback.
Not necessarily true. If you were summoned to the front by a local notification, for example, you'll also get an event about that.
Assuming there is no restart of the phone, point 2 is true even if there are hours between me tapping home and then tapping back the app icon.
Not necessarily. The app might well be terminated silently in the background.
Does it also persist device restarts but not force-restart?
Absolutely not. How can the app run when the device is off? Shutting down the app terminates every app.
I’m asking all of this because sometimes after putting the app in the background and tapping the app icon again (e.g. 10 minutes later), the app is going through it’s launch phase
It's not a matter of time. The watchdog process is constantly combing the suspended apps looking for the ones that take up too much memory so that other apps can run. You must not be surprised if yours is one of them.
You can come back to the front launching from scratch or by coming back to life from suspension; it's the most basic fact of iOS app life! You just need to accept it.
But there are lots of things you can do to reduce your chances of being terminated in the background. Giving up memory-consuming objects as you background is first on the list.

iOS: force-closed app restarting in background

We're seeing a strange situation on our iOS app that is impacting our user experience.
When a user background's the app (by pressing the Home button), we can clearly see the app entering the background. When the user then force-closes the app (by double-tappinging the Home button and sliding-up on the app), the app terminates normally. When the app is then re-opened, it follows the normal iOS start-up sequencing.
However, if the user double-taps the Home button while the app is running (resigning the app from active, but not sending it to background) and then force-closes the app (by sliding-up on the app), we're seeing the app terminate (the process gets killed), but then the app immediately re-starts in the background (with a new pid). The app is not designed to start-up or run in the background, and this is causing UX issues.
The app has no entitlements to run in the background, although we do have a couple of third-party libraries that have tasks that wind-down when the app enters the background.
I suspect the issue is a result of the app being force-closed from a non-active state rather than a background-state. If the app enters the background first, the third-party tasks are getting a chance to complete. If the app is force-closed from the non-active state, the tasks never get a change to complete in the background, so iOS is restarting the app in background to give those tasks a change to finish. It's unclear, however, if this is correct behavior.
-Stix
I'm kinda thinking the questions were self-evident, but if not:
Is this correct behavior for iOS? Should iOS be restarting the app in the background when the user force-closes the app w/o putting it into background?
If this is correct behavior, what can cause this to occur? Is it possible some third-party framework - still running a background task that hasn't completed - is the culprit?
The force-close works fine if the app is put into background first (giving background tasks the ability to complete/expire). Is there anyway to force it into background when force-closing the app while it's in a non-active state?

Open an app on battery notification

I'm looking for a way to open (or display a notification from) an iphone app when a low battery level notification occurs. Is it possible to perform it if my app is running in background ? I found that an app can't refresh after some minutes in background, but I wonder how many apps can display notifications by their own without being opened.
Thanks.

ios play continues sound when app receive push notification

Currently i am working on app in which i want to play continues sound when app receives push notification. as i know apple allow to play custom sound of length of 30 sec here is link..
but in well known app it plays continues sound in driver side when app is in back ground and driver receives order.
and another issue is of when my app is in back ground and receives push notification Rather clicking on notification if i open app by pressing app icon it does not show me data of push. it is not possible to load data when press on app icon here is link
iOS Push notification issue
but same thing is done in well known app
With iOS 7+, use application:didReceiveRemoteNotification:fetchCompletionHandler:, which is called even if your app is in the background. iOS will even launch your app in the background if it's not already running, but if the user force quits the app, it will not be re-launched. If you enable the remote-notification background mode, you can run app code when the notification arrives. If you include the audio background mode, you could initiate a sound that continues to play while app is in background.
For second question, typically, your app should query a server for updates if it's launched directly. However, you could leverage a remote notification as above, which you'd get in most cases (except if the app were force quit).

Navigation stops after 15 min in background skobbler

I am using Skobbler sdk in my application for navigation. I need to continuously send data of navigation to other device. But the navigation in background works for only 15 minutes after that it stops navigating in background. I have also tried enabling the following key value pairs in plist :
Required Background modes-
1. App registers for location updates
2. App downloads content from the network
Please suggest some help.
Please test this in a real situation, like actually driving while using the app with navigation type being SKNavigationTypeReal.
Background apps are suspended after some time and only activated when they actually receive GPS location updates. Your app will never resume if the device is not actually moving.
This is an optimization done by Apple to improve battery life.
Some more info about background modes:
https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html
The next release will include an API to disable this behavior.

Resources