Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How often check APNS feedback?

To detect invalid tokens, how often should I check the feedback service?

I have implemented a broadcasting system using the APNS service. I open a connection, send all the APNS messages, and disconnect. I then open a feedback connection right after the broadcast completes, and read any invalid tokens.

I do get invalid tokens on the feedback connection. However, often my broadcast will only partially succeed (some devices receive and others do not), and when I remove all but the known-good tokens, my test devices consistently receive the message.

I assume that means Apple is stopping the broadcast after it receives the first few invalid tokens.

So am I not listening on the Feedback properly?

like image 475
Justin Francis Avatar asked Feb 14 '12 15:02

Justin Francis


People also ask

How long does APNs certificate last?

Was this article helpful? APN certificate(s) downloaded from Apple only have one year validity from the date it was created.

What is APNs feedback service?

The APNs system includes a feedback service that can be queried to check for devices that have unregistered and no longer need to be notified. The device tokens maintainer: A Web Services server program maintaining the database of device tokens, with application user information.

What is the average amount of notifications per day?

The average person gets between 65 and 80 phone notifications a day, according to research being conducted at Duke University that was presented at a recent American Psychological Association Conference.

Are push notifications effective?

Push notification is also a powerful marketing tool. According to Invespcro, push notifications can boost app engagement by 88% and have led to 48% of mobile users making an in-store purchase. However, a push notification can get intrusive if not done the right way.


2 Answers

In the end, the only way to properly handle this problem was to move to Apple's newer "enhanced notification format". This format allows you to provide an ID to each message you send, and when Apple disconnects you, they send you the error and the ID of the message that caused the error.

This allows for the client to properly retry already sent messages, and drop the token that was invalid

like image 151
Justin Francis Avatar answered Sep 20 '22 14:09

Justin Francis


You should check the feedback response every time you send a push and delete inactive devices. Although, this does not look like your problem right now.

Your problem looks like you have some invalid tokens in your database. Apple will drop your connection if you send invalid tokens. Sending an inactive token will have no effect, but if you send a malformed/invalid token, Apple will kill your socket.

The other problem could be a missing retry scheme on your side. Did you implement any routine that will re-open the connection with Apple if it drops while you push ? You have to predict that the connection can fail, and if it does, you have to put it back up and start pushing again from where you stopped.

What you should look for is:

  • Make sure you only stock VALID tokens in your database
  • Make sure you have a retry scheme in place
  • Take a look at Notnoop, it is a very simple Java API that handles a lot for you
like image 38
pgratton Avatar answered Sep 20 '22 14:09

pgratton