Skip to end of metadata
Go to start of metadata

Performing data synchronization is typically done through a "pull" request to the server, to check whether there are new changes that need to be synchronized.  The "pull" request can be triggered, either manually initiated by user or triggered periodically at certain interval. 

This approach is acceptable for non-critical content or time-insensitive content. However for critical and time sensitive content, you can take advantage of push notification service to trigger data sync on your apps.

if you're not familiar with push notification service yet, please see Handling Push Notifications to learn more.

On this page:


The following illustration visualizes how Crosslight push notification service works. In general, the push notification service sent a silent notification to each registered device which will then trigger the data sync in the app.

To send a push notification that triggers synchronization, you can use Crosslight PushServiceManager.QueueSyncNotificationmethod such as follows.

When you send this push notification, you can handle the notification at app level in AppService as follows.

The above code example also shows how you can reuse the same sync logic that you might already implement in the OnSync method. The OnSync method is automatically called by the operating system when background sync is enabled. For more information about background sync, see Working with Background Sync Service.


Enabling Push Notification for Data Sync in iOS

To enable data sync through push notification in iOS, you need to set the info.plist as follows.

There are no additional efforts required to implement this capability in other supported platforms such as Android and Windows Phone.