Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Create a custom Cordova plugin which will isolate all sync processes and use a separate DB instance for persistence. This will be natively handled, as a result, the app performance will increase and loosely coupled.

Sync Db with CouchBase Mobile (Prefered)

A full-featured embedded NoSQL database that runs locally on mobile devices which will store the data and sync it to the temporary server, and from temporary server will sync to Platform after that it removes it and so .

...

Pros:

  • Installation process is easy

  • fast data access

Solution 2: Create a custom Cordova plugin to handle Background task.

WorkManager : Work Manager library does everything for you. It creates the database of your Request and Runs them accordingly.

Architecture:

...

 there is no need to handle the OS Version checks i-e if OS version is greater then 14 and lower than 21 then use the Job Scheduler Or Service Or Alarm Manager or if OS version is greater than 22 then go for Firebase Job Dispatcher or may you have many other ways like Alarm Manager + Broadcast Receiver to handle your background work but all of them have pros and cons

Some of the other key features of WorkManager include:

  • Persist scheduled work across app updates and device restarts

  • Schedule one-off or periodic tasks

  • Monitor and manage tasks

  • Chain tasks together

Workmanager handles all the conditions of Android OS versions itself and it runs on every device .

  • Uses JobScheduler for API 23+

  • For API 14–22

  • If using Firebase JobDispatcher in the app and the optional Firebase dependency, uses Firebase JobDispatcher

  • Otherwise, uses a custom AlarmManager + BroadcastReceiver implementation

Cons :

  • Consider using Foreground Service. Its also not a great idea to use them for parsing data and contents of view.

Plugin Method Defination

Plugin method init()

Code Block
languagejs
init: function(configurations: SyncConfiguration[], success, error) {
    exec(success, error, PLUGIN_NAME, "init", [configurations])
}

...