How can get the event when local data send to remote in app offline model development - genexus-sd

When the sendchanges property of the offlinedatebase(app offline model) is set to “when connected”, if the network changes from offline to online, the local unsynchronized data will be automatically synchronized to the remote server,
But now we need to call a procedure when this automatic synchronization occurs. How can we get this event

Related

Is it possible to use Remote Config on Web with real time update?

Following the doc below, we add to send FCM message to propagate updates of Remote Config.
Propagate Remote Config updates in real time
https://firebase.google.com/docs/remote-config/propagate-updates-realtime
But it's not working on Web because subscribing a topic is not working on Web.
Is it possible to use Remote Config on Web with real time update?

Callback in iOS application in offline mode

Is there any way to get a call back in the iOS application in offline mode, even if the app is in the background or not running state?
What I meant was - Is there a way to perform a particular task in the app (e.g. scheduling local notifications) at scheduled time, if the app is in background or not running state?
I would recommend using Firebase[1]
Once an app has connected to Firebase, the client will cache data locally and be able to access data where there is an outstanding "on" callback even after a network connection is lost.
You can enable disk persistence, your app writes the data locally to the device so your app can maintain state while offline, even if the user or operating system restarts the app.
You can enable disk persistence with just one line of code.
Database.database().isPersistenceEnabled = true
[1]https://firebase.googleblog.com/2015/05/announcing-mobile-offline-support_93.html
Creating a Notification Request
init(identifier: String, content: UNNotificationContent, trigger: UNNotificationTrigger?)
Creates a notification request object that you use to schedule a notification.
UNNotificationRequest

Swift/iOS - Syncing Offiline Core Data with Server when Device is Back Online

I'm trying to understand how I can send my offline data to the server when the device is online.
Can this be achieved without having the user to open the app, and send the data immediately when the device is connected to the Internet in background?
One viable approach would utilise file uploads with a "background session".
What it requires is a file that represents your Core Data objects. When you have that, create a NSURLSession object with a background configuration using static function backgroundSessionConfigurationWithIdentifier(_:).
When you schedule a task with the background session, it will be executed by the system in the background, even when your app is terminated. The system only tries to download the file when it has a connection.
For more information see Using NSURLSession and Handling iOS Background Activity.
There are a few configuration options (NSURLSessionConfiguration) which may seem important in your case, too:
discretionary and sessionSendsLaunchEvents

How iCloud sends a notification to my app when listening NSPersistentStoreDidImportUbiquitousContentChangesNotification

I need to persist data on iCloud and on a web service through Core Data.
I would like to notify my app when the data on the web service have changed exactly like iCloud notifies my app when the data persisted on iCloud have changed.
To handle the notification for iCloud I have to push a listener on NSPersistentStoreDidImportUbiquitousContentChangesNotification and I would like to make the same mechanism for handle the modifications made on the data persisted on my web service.
So, I would like know how iCloud notifies my app to trigger NSPersistentStoreDidImportUbiquitousContentChangesNotification notification ? And how can I making the same thing between my web service and my app ?
Thanks !
Apple doesn't document the full process, but the goal is that you can treat NSPersistentStoreDidImportUbiquitousContentChangesNotification in almost the same way as NSManagedObjectContextDidSaveNotification. That is, you can merge changes from iCloud as if you were merging changes made on a different managed object context in your app.
The iCloud notification involves things that you don't have access to and can't duplicate on iOS. Specifically, it uses a separate process on iOS called the ubiquity daemon (ubd). That runs outside of your app and independently of it, and is responsible for communicating with the iCloud service to send/receive any new changes. When it receives new changes it updates your persistent store file and notifies your app. Since you can't run external processes on iOS, you couldn't duplicate the exact flow even if you knew what it was.
The closest you'll be able to get is to start up a separate thread or queue to duplicate as much of ubd as possible. That thread would:
Download new data from your web service
Create a new managed object context and save the new data using this context
Either wait a while and repeat the process, or exit and leave it to you to repeat it later on.
When those changes are saved, NSManagedObjectContextDidSaveNotification will be posted automatically. You can handle that in more or less the same way as you would handle NSPersistentStoreDidImportUbiquitousContentChangesNotification. If you want a notification that only occurs when your app receives new data from the web service, you can post that after saving those changes.

Receive update from web server to iOS App and synchronize data

i'm writing an app that manage a sqlite database, and i have write a web server, i want the user register in my web server with username and password, i already know how make a request from ios app to server and receive the response, but i want enable also the synchronization of the sqlite database to other device, i now that with core data i can use iCloud synchronization, but for now i prefer use sqlite, and find a way to synchronize it, for example i want create this:
make a change in the sqlite in the iPhone app;
the app send this change to the server for that user;
then the server have to send this update to other device connected at that user;
and now i can't go over, how the server can send this change to the other device? the device has to be always listen to the server? or there is a way to send this update directly to some device and handle it? like an apple push notification?
EDIT: if it's possible use an apple push notification to do this, i doesn't want alert with text sound and badge the user, but send a "silent notification" it's possible?
As a high-level there are a few different ways to approach this, all of which have pros and cons. Two name two examples you can do a polling method, active push or a hybrid approach.
Polling: at some pre-determined interval the app tries to "phone home" and send the delta db changes up to the server. Here you know that your server will be expecting X number of responses in any given interval so you can appropriately gauge your load.
Active Push: The user decides when they want those changes to be transmitted to the server by hitting a "Sync" button. This allows the user to only push data back up to the server when they know there's a change but an over zealous user may make a change, upload, make a change, upload, etc instead of queueing up a bunch of changes and sending them all at once. This may create frequently unneeded server calls.
Hybrid: You setup a polling schedule within the app AND give the user the ability to Sync at-will in the event there is a critical change that needs to be made ASAP.
Regarding the listener side of the equation you face a similar challenge conceptually. If the original user makes 20 changes and presses Sync 20 times do you bombard the second user's device 20 times as well or do you queue those changes up and send them down every 5 minutes (as an example)? Unless you have both devices paired to each other or are connected to the same network AND visible to each other via your app you're going to need to leverage that back-end server. Push notifications can be very useful in this manner but there is extra development and setup overhead to take into account to properly implement them.
To boil this all down I would recommend laying out what YOU want your syncing model to look like before you start marching down a path.

Resources