Repeat Android services with differents times -
i created broadcast receiver starts 3 services. services don't have same intent, don't have same repeattime , don't have same id
here's how create it
the calling method :
createandstartservice(context, intentmobile, repeat_time_mobile, 12); createandstartservice(context, intentnetwork, repeat_time_network, 13); createandstartservice(context, intentsystem, repeat_time_system, 14);
and method starting services contains :
alarmmanager service = (alarmmanager) context .getsystemservice(context.alarm_service); pendingintent pending = pendingintent.getservice(context, id, i, pendingintent.flag_update_current); service.setinexactrepeating(alarmmanager.elapsed_realtime_wakeup, systemclock.elapsedrealtime(), repeattime, pending);
i can't figure out why repeattime overridden last value specified.
the code works once, , 3 services synchronized. if have idea me figuring out what's problem there, thank !
edit:
hendra wijaya djiono pointed out since kitkat, android os synchronizes services avoid waste of ressources. tried lot of different workarounds nothing worked.
the solution found set repeat time larger between services : if ask service repeat every 5mins , other 1 every 15mins, no problems !
Comments
Post a Comment