android Service not registered
Caused by: java.lang.IllegalArgumentException: Service not registered:[email protected]0
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;
}
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。