alternative to finish() method for Service class? To kill it dead

六眼飞鱼酱① 提交于 2019-12-04 23:30:13

use this line:

this.stopSelf();

to kill itself.
Or from outside use stopService(intent);

you can try as to stop your AudioService service from broadcast receiver :

Intent intent = new Intent();
intent.setClass(context, AudioService.class); 
context.stopService(intent);

where context is first param which you received in on Receive of broadcast receiver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!