0
Android가 처음인데 BoundService (로컬 바인딩)에 대해 배우고 있습니다.바운드 서비스의 onStartCommand() 메소드
나는 서비스에 연결하는 방법을 연구했고이 예제를 보았을 때까지는 아무 문제가 없었다.
@Override
public int onStartCommand(Intent intent, int flags, int startId){
startRandomNumberGenerator(); // a method that generates random number in a separate thread.
}
BoundService.java
내부 나는 Started Service
과 BoundService
(가) 별도의 물건 아니라는 것을 알고 있습니다.
그러나 bindService(...)
을 사용하여 about 서비스가 호출되었습니다. 우리가 bindService(...)
를 사용하여 서비스를 시작하는 경우
- 는 onStartService() 메소드를 호출 할 것인가?
바운드 서비스를 만드는 경우
onStartCommand()
메서드를 재정의하는 것이 좋습니다.
도와주세요. 미리 감사드립니다.
''서비스를 실행하기 위해'bindService (...) '를 사용한다면'onStartCommand (...)'는 실제로 쓸모가 없습니다. 즉, 'startService (...)'를 사용하고 있다면 bindService (...) 또는 (onStartCommand (...))를 사용하고있는 경우에는 onBind (...)를 오버라이드합니다. 그것을 함께 사용. – LightYearsBehind