google cloud messaging - Android GCMNetworkManager not executing while device idle -
i've used gcmnetworkmanager schedule service runs every minute. it's working fine while device active, once phone goes idle, i'm getting mixed results. (i tested 3 devices today service running whole day, writes date/time file).
galaxy s6, task fired around 4 hours, stopped until turned screen on. htc 1 m9, task fired on , off (but not consistently) around 3 hours, stopped until turned screen on. htc 1 m7, task stopped firing pretty after phone went idle , never ran again day.
i want service run while idle, doing wrong?
long periodsecs = 60l; // task should executed every 1 minute long flexsecs = 30l; // task can run -30 seconds scheduled time string tag = "task_scan"; periodictask periodic = new periodictask.builder() .setservice(myservice.class) .setperiod(periodsecs) .setflex(flexsecs) .settag(tag) .setpersisted(true) .setrequirednetwork(task.network_state_connected) .setrequirescharging(false) .setupdatecurrent(true) .build(); mgcmnetworkmanager.schedule(periodic);
Comments
Post a Comment