I have scheduled a task to run periodically using GcmNetworkManager
, but I don't want it to be persisted, because I don't want to add android.Manifest.permission.RECEIVE_BOOT_COMPLETED
to list of the permissions my application requires. So, I am currently scheduling the task in onCreate()
of my main activity. I was wondering, is there a way to query GcmNetworkManager
about my task and if it has already been scheduled, skip this?
There is method in Task.Builder
called setUpdateCurrent
(link).
It is optional setter to specify whether this task should override any preexisting tasks with the same tag. This defaults to false, which means that a new task will not override an existing one.
Hope it helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With