android - GcmNetworkManager perodic task handling -


i need schedule task runs every 24 hours small data remote server. gcmnetworkmanager seems prefect candidate need support sdk 15+. (jobscheduler 21+).

the way achieving extending application. oncreate, create periodictask specific tag , call .setupdatecurrent(false) (so 1st 1 gets scheduled , subsequent tasks should ignored should not update existing task).

in documentation read

important: when google play services or client app updated, scheduled tasks removed. gcmnetworkmanager invokes client app’s oninitializetasks(). override function reschedule necessary tasks.

in scenario, should not matter oncreate of application creating update task. there better way doing? (also wish there way check if there pending periodic task given tag)

unless listening action_my_package_replaced in broadcastreceiver (and scheduling task there well), should still override oninitializetasks() create same periodictask. otherwise, there may time between when app updated google play store , when manually run user have no periodic task scheduled.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -