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?
Asked
Active
Viewed 392 times
5

iMan Biglari
- 4,674
- 1
- 38
- 83
1 Answers
2
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

busylee
- 2,540
- 1
- 16
- 35
-
I know about this method but it is like creating the whole task and then letting GC take care of it. I was hoping to determine whether my task is there before actually creating a new one – iMan Biglari May 05 '16 at 13:02