Page 1 of 1

pushnotification - keeping the mobile id database "clean"

Posted: Sun Jul 08, 2018 1:37 am
by xsymetrix
Got push notifications working (fist pump moment when that little red circle with a 1 appeared on my iphone app). Then I got worried about someone turning notifications off and my app continuing to bombard them as I looped through the list of mobile ids that had been captured and stored in my mysql database. I read a post by Mikey referring to keeping the mobile id (current) stored with the device and checking to see if it had changed... then I could get rid of the old id and update it - I liked that approach.

My Question
How can I tell if someone has opted out of notifications - or is it unimportant because the APN server will only send messages to those who have opted in on their device for push notifications for my app... regardless of whether I send one to that Mobile ID?

Regards
Mark Christie

Re: pushnotification - keeping the mobile id database "clean"

Posted: Sun Jul 08, 2018 2:41 pm
by Mikey
Howdy, Mark.
Now that you have that working, please bug LC about extending push support. There are a couple of bug reports open on that topic, including supporting silent push (still waiting...)
To your question, there is good news: If someone opts out of notifications in the control panel on their device, it doesn't matter what you do, your messages won't make it through. Apple may complain if you don't remove devices, but whether they will or not I don't know.
If you're using John's APNS helper, there is code in there to check for the push id's of people who have withdrawn (disabled push for your app). I also have it (in an SOS) at https://github.com/macMikey/APNsAssistant
In my library, check the behavior script for the APNSAssistant stack. You will find a routine called "checkFeedback". Parse the feedback from Apple's feedback server to grab the ID's that need to be removed. The checkFeedback adds some extra text on the message, so make sure you read the code and understand it so you can properly parse it.
Note that it can take some time for a user's withdrawal to be reported by the server (read days).
Also note that push id's change, so make sure that your app knows what its push ID was, and if it changes, send the new one to your server. The other reason to have your app check its push ID is because if a user opts out and back in, you will need their new ID.