如何准确地停止广播接收器中的服务?我使用的短信接收广播接收器。
我在用
context.stopService(new Intent(this, CallService.class));在哪里"CallService“是我的服务,但我收到了
The constructor Intent(SMSReceiver, Class<CallService>) is undefined而快速修复就是remove the arguments to match 'Intent()'
我在这里做错什么了吗?
要停止广播接收器,我所要做的就是context.unregisterReceiver(SMSReceiver.this);,仅此而已?我一定要做onDestroy什么的吗?谢谢。
发布于 2012-09-25 16:47:40
使用context而不是this实例化意图,如下所示
context.stopService(new Intent(context, CallService.class));注销部分是正确的。
https://stackoverflow.com/questions/12587198
复制相似问题