I have implemented the Push Notification Successfully in the application, and I need to provide an option to user Where they can set the time for not showing receiving notification. all other time they can receive. I am storing the detail of their Do Not Disturb time in the database in the backend. I just want to check when the notification is fired. the current device time of user. and if that falls under their DND time. Notification is not to be shown and event the sound is not to be shown. Even in the Notification Section.
Any Help will be appreciated.
You can get the the timezone of the device along with the schedule. Depends on the time you need to fire the notification from your server.
i.e, once you fired the notification from your server you can't stop it from showing
Related
So I have a working app that sends notifications every day reminding you to mark something complete. Right now the problem is that even when they have marked all requirements, they still get the notification. Is there a way to conditionally fire a notification? For example, only fire the notification if A==false.
If the user marks all requirements, remove the corresponding notification from the notification center.
I have a problem scheduling UILocalNotifications.
My case is this: when user selects motivation category there is a dialog screen where he selects how many times in a day, week, month, motivation message should be presented to him. Then he selects time period: a day, week or a month. A motivation category has messages, and every category has different number of messages.
So my question is: how should i schedule those notifications? Main problem i think is that there can be more than one category. Can someone tell me how to do this?
I know that i cant schedule more than 64 notifications, so i cant schedule all notifications when category is selected. And i know i could reschedule notifications in
application:didFinishLaunchingWithOptions:
or
application:didReceiveLocalNotification:
I hope i have been clear about my problem.
First write a function that manages the local notifications
that is it has to check if there are 64 notifications scheduled if not then you may add some notification.(you have to handle DB part well for example setting the flags correctly)
Call the function in application:didFinishLaunchingWithOptions: just in case some notifications are expired or missed
You have to call the function in all the places where local notification is handled.
The user taps a custom action button in an iOS 8 notification.
In this case, iOS calls
application:handleActionWithIdentifier:forLocalNotification:completionHandler:
You also get the local notification object, so that you can retrieve any information you need to handle the action.
The user taps the default button in the alert or taps the app icon.
The system launches the app and the app calls its delegate’s method, passing in the local notification object
application:didFinishLaunchingWithOptions:
The notification is delivered when the app is running in the foreground.
The app calls the UIApplicationDelegate method
application:didReceiveLocalNotification:
Reference1:
Reference2:
I hope this helps.
If it doesn't cover your problem feel free to ask doubts
It works as pool when you utilized all your available notifications then you need to reschedule the free notifications in
application:didReceiveLocalNotification: but every time you are gonna reschedule you can find next notification to user that could be in today, tomorrow. Whenever you are in application:didReceiveLocalNotification: findout when to notify next and schedule.
I am new to iOS
I want to get the index of the UILocal notification on which the user pressed View.
For example if i have 5 local notification on an app how and the users opened the 3 rd one how can I display programatically all the notifications and how to check which index of which notification did the user press?
Local notifications have no concept of an index. The index is representative of the fire date. When the user opens the app from a local notification, that notification is passed as a parameter so you can access the fire date and, probably more importantly, the userInfo.
All that said, you have no way to access the list of notifications that were being displayed in notification centre. If the user cleared old notifications you can't tell. You only know about the notification that the user was actually interested in and used to open the app.
Currently I am implementing an ios app with the server push notification.
I am successfully able to send push notifications with badge.
Badge count will be incremented from the server. If user opens the application from notification, it will reset count on the server.
Now the query is if user is not opening application from notification and deleting/clearing all notifications.
That means there will be no notification so when app will be opened from the background it wont find any notification and so it will not reset the count on server and also not the badge value on app icon.
So how can i resolve this issue?
Use custom notification icon and maintain read and unread counts with in the app,you will not manage badge counts from push notifications when user remove and open notifications in the app.
From what I understand, the only way your app is getting the relevant data is if the user clicks on the notification. I'm assuming you're sending a custom payload of some kind. Though I don't know the nature of your app at all, I would say this is really not the way to go specifically because of the problem you're encountering - you have no way of knowing if/when the user clears notifications in the Notification Center and if they do, that data is forever lost to your app.
I would recommend your app request the new data from your server upon launch - ie/ get anything new since last time the app was opened - this way it's independent of whether the push was received or not and depending on what your server sends back, you can clear the push count (or not).
Whenever application hits appDidBecomeActive delegate, clear the badge count to zero.
I am trying to schedule push notifications using Parse in iOS. I only have a free account (meaning that I cannot schedule notifications in the web backend), so I came up with a solution for scheduling the notification through Parse:
Within the app, when you press send notification you set the text and a date to send the notification (using the code to just send a standard PFPush code). Then I just use NSDate and every day check the date to see if it matches the date for the scheduled notification. If it does, it sends the notification; thus sending the notification on the scheduled day, if it is not the matching day, nothing happens (no notification is sent, and the app rechecks in another 24hrs). This works, but the app has to be open in the foreground at the time that the notification is scheduled for sending (i.e the date is not checked and notification not sent if the app is in the background). So my actual question is how I can run all of this in the background, so the app can just be in the background on my iPad, and it will still check the date and be able to post the PFPush (push notification).
Any help or code would be much appreciated.
Thanks so much in advance, and let me know if you need more information!
In this case
setMinimumBackgroundFetchInterval means that it is not called in an interval which is smaller than the value you specified. But there's no setMaximumBackgroundFetchInterval. So if iOS decides to call your app just once a day or even just once a week than it won't be called more often regardless your minimumBackgroundFetchInterval. AFAIK iOS decides when to call performFetchWithCompletionHandler measured by the pattern when and how often the users start's the app.
In Xcode 5 Debug mode, you can force a background fetch from the menu: Debug > Simulate Background Fetch.