IPhone notification access

I am developing an application for the iPhone and using push notification to create chat features in my application. When the application receives a notification, the message is then stored in the SQLite database from which the message is populated. My problem is that sometimes the phone receives a notification while the application is not running, but when the application starts without clicking on the notification (or when there are several notifications), I just don’t have a way to handle these notifications. What I like is when the application starts, I check all local and push notifications, process and clear them from the Apple notification application. I hope my question is clear enough. thanks

+4
source share
1 answer

There is no API for accessing notification information in iOS. The only way to get notification information in your application is that the user activates your application from the notification.

For this reason, chat applications on iOS, such as AIM, Textie, etc., check their servers for new messages when they are activated. I suspect you will have to do the same.

If a user activates your application from a notification, you can still use this information for a proper conversation, but the contents of this conversation must be filled out from the server.

In addition, the only way to programmatically β€œclear” notifications is to set the value of the application icon icon to zero.

+1
source

Source: https://habr.com/ru/post/1384463/


All Articles