, 나는 startService
과 bindService
모두를 호출Android 서비스의 경우 unbindService와 stopService를 모두 호출해야합니까? 내 안드로이드 응용 프로그램에서
Intent intent = new Intent(this, MyService.class);
ServiceConnection conn = new ServiceConnection() { ... }
startService(intent)
bindService(intent, conn, BIND_AUTO_CREATE);
나중에 둘 다 unbindService and
stopService`를 시도 :
unbindService(conn);
stopService(intent);
그러나, 나는 unbindService
호출에 예외를 얻을. 이 전화를 제거하면 앱이 stopService
전화를 통해 제대로 실행 된 것으로 보입니다.
내가 잘못 했나요? bindService
전화는 unbindService
전화와 연결되어야하고 startService
전화는 stopService
전화와 연결되어야한다고 생각했습니다. 이것은 여기에 해당하지 않는 것 같습니다.
혹시 이것을 알아 냈습니까? 나는 똑같은 것을 만났고, 나 자신을 위해 unbindService (conn)를 주석 처리했다. 괜찮아 보이지만, 너와 똑같이 내 직감은 백그라운드에서 뭔가 싫어한다고 말한다. –