Offline data sync - after close my app


#1

Hi,

i am a newbie in ionic.
also my englisch is very wrong. I hope you understand my problem.

Is it possible to build a ionic offline app which can sync data after i have the app completed closed.
I have try it with couch - pouch DB but it doesn’t work.

My workflow example:

  1. I am offline
  2. run my app
  3. save data from app localy
  4. close my app - IMPORTANT !!! full closing, for example iPhone double push Homebutton …
  5. now i am online
    6 … ??? what is now?
    It will not sync.
    Is it somehow possible to sync data without start my app.

Do you understand my question?

Thanks for your help

Currently i use ionic with angular 4


#2

Not running code can not do anything. Forget that idea.

What could work is using a background mode thing, using https://ionicframework.com/docs/native/background-mode/. Look into that.


#3

Hello Sujan12, thanks for your reply.

what you say is right.

can i register a job in to os. i will delegate this task to the os.
is there a service worker or something similar?

your background example is working, but only for long tasks. if user closing the app completely the task will be stop or broken. also the task is lost.

do you know what i mean?
do you have a idea?

thank you


#4

I know what you mean, but don’t think this is possible. At least I don’t know an easy way to solve this.