pushnotification - keeping the mobile id database "clean"

Getting into LiveCode for iOS? Ask your questions here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
Posts: 4
Joined: Fri Mar 23, 2012 10:37 pm

pushnotification - keeping the mobile id database "clean"

Post by xsymetrix » Sun Jul 08, 2018 1:37 am

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?

Mark Christie

VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 725
Joined: Fri Jun 27, 2008 9:00 pm

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

Post by Mikey » Sun Jul 08, 2018 2:41 pm

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.

Post Reply

Return to “iOS Deployment”