首页 > 代码库 > Service not registered
Service not registered
Caused by: java.lang.IllegalArgumentException:
Service not registered
:
com.broadcom.bt.app.settings.ServiceExtraSettingsActivity@414e11e0
at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:923)
at android.app.ContextImpl.unbindService(ContextImpl.java:1234)
at android.content.ContextWrapper.unbindService(ContextWrapper.java:405)
at com.broadcom.bt.app.settings.ServiceExtraSettingsActivity.onPause(ServiceExtraSettingsActivity.java:169)
at android.app.Activity.performPause(Activity.java:5108)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1225)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2838)
... 12 more
服务未注册,看到其他博客上是用this.getApplicationContext去获取的bindservice
但为了保险起见,我的做法是设置一个布尔型的变量
1、private boolean isBind = false ;
2、isBind = bindService(svcMgrIntent, this, Context.BIND_AUTO_CREATE);
3、if (isBind) {
unbindService(this);
isBind = false;
}
at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:923)
at android.app.ContextImpl.unbindService(ContextImpl.java:1234)
at android.content.ContextWrapper.unbindService(ContextWrapper.java:405)
at com.broadcom.bt.app.settings.ServiceExtraSettingsActivity.onPause(ServiceExtraSettingsActivity.java:169)
at android.app.Activity.performPause(Activity.java:5108)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1225)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2838)
... 12 more
服务未注册,看到其他博客上是用this.getApplicationContext去获取的bindservice
但为了保险起见,我的做法是设置一个布尔型的变量
1、private boolean isBind = false ;
2、isBind = bindService(svcMgrIntent, this, Context.BIND_AUTO_CREATE);
3、if (isBind) {
unbindService(this);
isBind = false;
}
Service not registered
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。