Transfer Data via Push Notification

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
ace16vitamine
Posts: 130
Joined: Fri Apr 13, 2018 1:53 pm

Transfer Data via Push Notification

Post by ace16vitamine » Thu Aug 05, 2021 11:28 am

Dear all,

I have a simple question. My iOS App is showing informations out of a Database. In the case that there is a new entry in the Database, I am generating a push notification for the iOS / Android Client with "Hello Bla Bla you have new Orders". After that the client can download (after opening the App) the Order.

My question: Can I transfer the Information / Data from the Database with the Push Notification (as content) to the Client? I think not...Or?

If not:
How can I tell the App to download the informations automaticly (while running in background) after a push notification is received?

Thanks
Stefan

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

Re: Transfer Data via Push Notification

Post by Mikey » Thu Aug 05, 2021 2:22 pm

A few things:
1. LC does not support so-called "silent push". It is a very old request that is still not supported. You can't just push data to the app without triggering another event because
2. LC behaves differently for push notifications that are received when the app is active and when it is not. You can't currently cause your app to do something if it is not active, like receiving a payload.
3. What you can do to handle the case where your app is not active, is send your push notification with a badge value (that's the number that appears in the red circle - the badge - in the corner of the icon on the home screen). When you launch your app, check the badge and act based on that, like having your app connect to your web server to pull information (and then reset the badge to 0).
4. Push does not support large payloads, so even if your app is open, the amount of stuff you can send in a single message is limited (and LC's ability to manage multiple push notifications is also limited).
5. Push notifications are not guaranteed to be delivered.
Also
6. Push ID's change, so make sure your app keeps its last push id and checks it periodically. If it has changed, notify your server that it has changed, otherwise, your server's notifications will not make it to your app.
7. Users can disable push notifications at any time for your app, and there is a very good chance that you won't be notified of that. I am also not aware of a way to check inside of your app to see if push is enabled or not.

Given all of that, the thing you can do is have your app periodically query your web server to see if something has updated, and if it has, pull those updates. 4D, another program we use, here, uses this mechanism. Your mobile 4D app queries your 4D server and checks for changes in sequence numbers on tables, then pulls the records that are more current than the ones in the local (ios app) database.

Post Reply

Return to “iOS Deployment”