blue-systems-group / project.maybe.android.library

Maybe Library, under develop, NOT ready for use!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need a mechanism for periodic PULL

xcv58 opened this issue · comments

commented

Only use BOOT_COMPLETED is not good enough. If someone never reboot phone.

commented

Right now, it uses GCM Network Manager in my local branch. But it seems not optimal solution.

From https://github.com/jacktech24/gcmnetworkmanager-android-example/blob/master/README.md

There must be (as for now) installed Google Play services to make this work (even on Lollipop+).

So it requires extra work to detect whether Google Play Services exist, and probably need a backup solution if Google Play Services not exist.

Can I get the queque of the tasks from in-app?

Again, for now, you can't. There is no API for getting list of your scheduled tasks.

So it seems we need maintain the task exist state by ourself.

In short

There're two way to init our periodic pull task:

  1. BOOT COMPLETED
  2. The first time app open.

But we don't wanna it happen twice. So we need make sure only init the task once. If it's impossible, we need make sure the subsequent init doesn't take effect and disturb first one.