I have an app made with phonegap which is using a third-party plugin for displaying local notifications. (https://github.com/katzer/cordova-plugin-local-notifications)
I deployed it on my device, and in the beginning it worked well. However after the app sent dozens of notifications (very frequently and with same text) at some point my iphone started not showing the notifications. I tried to delete the app, and deploy again, then the confirmation dialog popped up again for allowing notifications from the app, but they still didn't show up.
When i deployed it on an other device, it worked well again, also in the emulator.
Is it possible that ios somehow blocked notifications from this app, because it considered them as harmful/spam?
Maximum number of scheduled notification is 64. If you are reached the maximum you can't add more local notifications without removing the old ones or after firing the scheduled notifications.
In the apple documents, it mentions as follows
Each app on a device is limited to 64 scheduled local notifications.
The system discards scheduled notifications in excess of this limit,
keeping only the 64 notifications that will fire the soonest.
Recurring notifications are treated as a single notification.
There is a limit of 64 scheduled notifications per app, so, if you schedule more - only first 64 will arive.
Each app on a device is limited to 64 scheduled local notifications. The system discards scheduled notifications in excess of this limit, keeping only the 64 notifications that will fire the soonest. Recurring notifications are treated as a single notification.
However, there is a way to be sure that all 64 are scheduled - just pass them in packs by 64 notifications each.
Check this answer for more info.
Related
As stated clearly in Apple docs, beacon ranging can be done in background for a short period of time only, say up to 10 seconds by default or up to 3 minutes with the help of background task expiration handler. As per my app's use case, app needs to do beacon ranging for every 15 mins until user exits the region. I am thinking of using background push notification(silent push notification) for this purpose(assuming data connection is available on the device always). So the flow goes like this, upon user entering the region, app calls the server with device token, server sends silent push notification for every 15 minutes. Once app received push notification, it does beacon ranging within allowed period of time if needed. Question I have here is whether using push notification in background mode to do ranging is legal, will I face any issues during app store submission.
Note: Also I need to enable BLE background mode for the app, to read some characteristics from some BLE devices.
Technically you can do it, but Apple mostly rejects such app. One important thing you have to consider is that, if the app is manually killed by the user and not running in the background, then the app won't wake up with silent push notification. There is a workaround if you have VoIP push notifications it will wake the app even from the terminated state. But you might need strong reason while pushing it to AppStore.
If you misuse one of the background modes, the app will probably be rejected, saying that, I don't think silent push notifications were meant for: keep an iOS app in "Background" state by sending it a silent push notification every few minutes.
another thing is that silent push notifications are rate limited as described http://asciiwwdc.com/search?q=push+notification, so I'm not sure if they will be sent every few minutes.
Apple says that;
Silent notifications are not meant as a way to keep your app awake in
the background, nor are they meant for high priority updates. APNs
treats silent notifications as low priority and may throttle their
delivery altogether if the total number becomes excessive. The actual
limits are dynamic and can change based on conditions, but try not to
send more than a few notifications per hour.
You might want to see this article. The user talks about apps that use silent notification for triggering location tracking. But eventually it's a hack that Apple may reject some time in the future, so it's best to have a contingency plan. FWIW so far I haven't heard anyone reporting rejection.
So the official answer is don't do it, as for the why you can refer to Ashish's answer. The unofficial answer is if you can't change your business logic then do it at your own risk.
The iOS application I'm working on does the exact same thing with the exception that I'm using recording instead of a Beacon. Recording by iOS standards gives more issues in pushing the app to the app store.
But Apple did not reject this app. Although we still are facing some issues but they don't relate to your problem.
You can follow such a tutorial for further help apart from the answer you were looking for : iOS Push Notification Demysitfied
Also, I've done firing of local notifications, while the application is in the background. BLE even works if the app is killed by the system, when the OS receives some communication from your peripheral or central, iOS wakes your app up and executes the desired function, before putting your app back to sleep.
I'm working on an app where I need to send a good amount of notifications to the user daily. Around 5-40 depending on the user.
I'm using local notifications to send it, but I know there is a 64 notification limit. Does this mean 64 notifications per day, or in total?
It means simultaneously scheduled for future delivery. You can send as many as you want per day, provided they don't overlap.
If you add more than 64 requests (under UserNotifications) or scheduled (under UIApplication/UILocalNotification), the older ones will be dropped and not delivered.
Unfortunately iOS limits the local schedule notification up to 64. May be to prevent this issue can schedule first group of notification initially and then schedule another group when launch the app next time.
As I see in many apps when setting user notifications as reminders, it works fine but after a while when the user starts to ignore opening the notification or the app it won't send any more notifications.
Is there a way to disable this behavior and continue sending the notifications even if they don't open the app?
What you are describing sounds like local notifications. These are scheduled in code to go off at a specific time. As far as I know there is no such thing as a recurring local notification. They are "simulated" by creating many single local notifications to begin with.
Edit
As PaulW pointed out. Recurring notifications are possible but are rarely used due to their limitations.
When the app is opened it runs some code to create some more local notifications.
If the app is not opened then the code never runs to create the additional notifications.
So, in this example, it is not iOS stopping the recurring notifications because you haven't opened the app. The notifications stop recurring because you don't open the app and give it the opportunity to create more of them.
So, to answer your question. No. The only way to delay this as long as possible is to create notifications that cover a long time into the future. But then I believe there is a limit to the number of scheduled notifications. (A quick google comes up with a limit of 64 scheduled notifications per app).
Edit you could also use repeating notifications but they are limited to repeat every one unit of time. Once a day, once and hour, once a minute, etc... so you can't do it every two hours.
Alternatively you could use a backend to send remote notifications. These could theoretically recur infinitely because the app is not required to create them. Of course, this assumes you have the infrastructure setup to develop this.
I have a swift 2 app in which you can create entries in Core Data.
Each entry will register a local notification.
The problem is the limit of 64 local notifications.
Is there an way to solve this "problem" with the limitation?
Kind of (thanks #dfri). However, repeated notifications only count as one notification, but it appears that you have 64 completely independent notifications.
From the Local and Remote Notification Programming Guide:
Each app on a device is limited to 64 scheduled local notifications. The system discards scheduled notifications in excess of this limit, keeping only the 64 notifications that will fire the soonest. Recurring notifications are treated as a single notification.
The only semi-viable alternative is (see this repo):
Hope that your users open your app within 64 notifications.
Schedule remaining notifications.
In Apple's Local and Push Notification Programming Guide, it says:
Each application on a device is
limited to the soonest-firing 64
scheduled local notifications. The
operating system discards
notifications that exceed this limit.
It considers a recurring notification
to be a single notification. LINK
However, in the iOS Application Programming Guide, it says
Listing 4-3 shows an example that
schedules a single alarm using a date
and time that is set by the user. This
example configures only one alarm at a
time and cancels the previous alarm
before scheduling a new one. (Your own
applications can have no more than 128
local notifications active at any
given time, any of which can be
configured to repeat at a specified
interval.) LINK
Which of these is true? Do I get 64 notifications or 128 notifications?
I finally did a test, and the answer is 64 local notifications.