LoginSignup
0
0

More than 5 years have passed since last update.

Serviceの状態について

Last updated at Posted at 2017-07-06

Serviceの状態

Serviceは基本的に2つの状態がある
StartedとBound
起動要因により状態が変わり、状態により終了条件が変わる

Startedとは

startServiceによって起動された時にStarted状態となる
呼び出し元が消えてもServiceは動き続ける
Service自身が自分をClose処理する必要がある
例えば、ファイルのダウンロードなど、自身で動作完了が判断できる時に使う

Boundとは

bindServiceによって起動された際にBound状態となる
呼び出し元が生き続ける限りServiceも生き続ける
呼び出し元とunBindになるか、呼び出し元が消えると、Serviceも消える
Bound状態のServiceはクライアントサーバ形式のInterfaceを持ち、バインドされたコンポーネントとプロセス間通信ができる

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0