I'm new to the services and I can not find a way to stop the services launched by the alarm manager < / P>
This code is to stop the service:
stopover () {Cancel alarm (getApplicationContext ()); Intent1 = new intent (this, CrService.class); StopService (intent1); } // Rule Alarm Cancel Public Alert CancelAlarm (Reference Reference) {Intentional Intention = New Intent (Reference, ReceiverPositioningAlarm.class); Pending Sender Sender = Pending Intent. Gatebrastro (Reference, 0, Intent, 0); AlarmManager AvdhiCralarm = (AlarmManager) context.getSystemService (event .ALARM_SERVICE); AvdhiCralarm.cancel (this); Sender.cancel (); // Stop Service (new intent (this, CrService.class)); }
stopwars () {CancelAlarm (getApplicationContext ()); } // Rule Alarm Cancel Public Alert CancelAlarm (Reference Reference) {Intentional Intention = New Intent (Reference, ReceiverPositioningAlarm.class); Pending Sender Sender = Pending Intent. Gatebrastro (Reference, 0, Intent, 0); AlarmManager AvdhiCralarm = (AlarmManager) context.getSystemService (event .ALARM_SERVICE); AvdhiCralarm.cancel (this); Sender.cancel (); // Simply type your reference before call stop service & amp; Your name class before this reference. Stop service (new meaning (Yourcalss.this, CrService.class)); ^ ^ | -------------------------------- | }
Comments
Post a Comment