I'm trying to send UILocalNotifications and delete them automatically after a certain interval from the Notification Center.
My app sends information to users that in about 5 minutes since sending would be irrelevant.
There are going to be at least 3 notifications a day.
Since the information of the notifications would be irrelevant in a few minutes, it would be much better to delete those notifications from Notification Center - because they would be irrelevant to the user.
Is there any way to achieve this? Sort kind of a "self-destruction" option of local notifications?
Thank you!
If your question is to remove the notifications from the notification centre even without bringing the application to foreground(new notification to clear the old notifications), then the answer is straight forward "NO".
Without user accepting the older notification or manually brings the
application to foreground - It is not possible.
A possibility if this feature may come out with iOS7!
Related
I observed in iPhone that,When an app receive too frequent notification and that app is in background,iPhone does not show banner for all notification,instead it shows banner with message " You have 6 new Connect notification." ( 6 is the push notification count and connect is the name of app.).Is this behaviour documented anywhere?
As for your question of where it is stored, it is probably stored in the cache of the phone (which is cleared every so often) so you're not being monitored and watched as far as I know of. If you wish to turn off these notifications you can do so in the settings. Hope I answered your question!
This question is probably the same as Duplicate Apple APNS push notifications?, but since that one didn't get an answer, and I have some more information, I'll try to ask it again.
Steps to reproduce the problem:
Set notification center to display notifications as alerts, this will make the problem more obvious.
Make sure the app isn't running in the foreground.
Send 3 identical push-notifications in rapid succession.
Wait until the messages arrive at the phone, you will now have to dismiss the alert 3 times.
Now send 1 more notification, that isn't identical with the previous ones.
You now get that last notification, but you'll also get one of the previous notifications showing up once more. This is the problem.
If you continue to send single notifications, one of the first 3 will keep popping up when it shouldn't.
Here is a video that follow these steps, which clearly shows the problem:
http://youtu.be/TSqt8S4FY6w
We have just as Remy Gale did in the linked question above made sure that our notifications are sent in the correct way, and only once per notification. We have also tested this with both the sandbox-apns and the production-apns, both behave exactly the same.
The problem disappears if the app-badge is set to 0, which in turn removes all notifications from notification center. Removing the notifications manually doesn't help.
UIApplication *app = [UIApplication sharedApplication];
app.applicationIconBadgeNumber = 0;
But that isn't a solution.
The problem doesn't appear if all notifications contain unique text. Adding a GUID to the alert-text will make the problem disappear. Adding it to the apns-payload as a custom property or as a localized argument will however not help, so this is also not a solution.
This will probably rarely happen in a production environment with a live app, but it can happen, and when it does, it is really annoying for the users!
Does anyone know why this happen? Does anyone have a viable solution?
This Google Group for Gmail has an entry from a user who has researched the bug a bit and includes a possible workaround. According to the entry the bug is not present in iOS 5 but was introduced with iOS 6.
The workaround is simply appending a random number of Zero-width non-joiner to the title in order to assure uniqueness.
This could be an issue with the timestamp that the server is picking while sending a push notification to APNs. Pick only the latest timestamp.
This question already has answers here:
How to catch application uninstalling on device and let server know about this (iOS/Android)
(2 answers)
Closed 9 years ago.
I wish to hit a web service, whenever a user deletes the app from his/her device. Its just to delete that user from Db. Can anybody here help me?? Thanks In Advance..
Generally speaking, what you are attempting is probably not advisable. Even if it were possible to know when a user has deleted the app, how would you handle the situation where the user then re-installed the application and launched it? You also do not know why the user has deleted the app (perhaps they only wish to do so temporarily to free up space on their device? Perhaps their device was stolen and they are re-installing into a new, or upgraded device?)
If you separate your concerns (client has/does not have mobile app, vs client has/does not have active account) you can manage all these scenarios in a much more robust way.
Using an in-app analytics package (like Google Analytics, Parse or Flurry to name just a few) will give you insight as to your user behavior, and perhaps based on this usage data you can trigger handlers. For example, if you see a user has not used your app in a certain period you can email them or send a push notification to remind them? Perhaps you could email them to notify them "You have not logged in in 60 days, if you do not use your account within the next 30 days it will be deleted. Click here to re-activate your account."
No, can't do. There is no defined notification when an application is deleted. If you must talk to a server, suspend inactive accounts after a predefined time limit.
One other thing you can try is check for the UIApplicationWillTerminateNotification notification. Save the state of your app on your servers when it's transitioning to the background and cross your fingers your user will not delete your app when it's not running. Because once your app closed, you don't have any control anymore. Thats the iOS behavior till iOS 6.
There is no way you could know whether the app is deleted from device or not because no delegate method fires when the app is deleted.
Hope it helps you.
I am new iPhone developer,
Can anybody suggest me what should i do here:
I have built an App in which i am finding how far the user from end location or a goal, So I have a given range (nearBy) here, if the user came within the range , he/she got a message or alert.
My question is how can notify the user? how could I show that message?
I am greatly appreciative of any guidance or help.
UILocalNotification
Instances of UILocalNotification represent notifications that an application can schedule for presentation to its users at specific dates and times. The operating system is responsible for delivering the notification at the proper time; the application does not have to be running for this to happen. Although local notifications are similar to remote notifications in that they are used for displaying alerts, playing sounds, and badging application icons, they are composed and delivered locally and do not require connection with remote servers.
You should take a look at UILocalNotification Class Reference.
I have an app that I am working on, and part of its main functionality is to alert the user to do something. So even though they aren't in the app, I want to be able to pop up an alert from the app, reminding them to do something. Is that allowed with the iPhone sdk? Maybe it isn't even a big deal at all, but for some reason I was thinking that it would require background processes or something that may or may not be possible. Anyone who has any thoughts about how this would be implemented would be greatly appreciated. Thanks!
Check out the Apple documentation on push notifications. Short of jailbreaking and distributing your app outside the App Store, there is no way to run background processes at this time.
It is allowed through notifications, though you will need a server to actually send the notifications to the user. There is no limit to the number you can send, although the user may very well decide to shut off notifications or delete your app altogether if you are too spastic with them. Make very sure the user understands the notification volume they will receive and agrees to it...
The way the system works is the user gets a notification message (and/or sound) and can decide to open your app or not, as the time of notification.