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?
How can I query GcmNetworkManager to see if my task is scheduled or not?
394 views Asked by iMan Biglari At
1
There is method in
Task.Builder
calledsetUpdateCurrent
(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