最終更新:2016-01-05 (火) 14:30:53 (3027d)  

Service.startForeground
Top / Service.startForeground

public final void startForeground (int id, Notification notification)

http://developer.android.com/reference/android/app/Service.html#startForeground(int, android.app.Notification)

Make this service run in the foreground, supplying the ongoing notification to be shown to the user while in this state.

  • フォアグラウンドのサービスは、ユーザが積極的に意識するものとして考えられ、それゆえにメモリ残量が少なくなった際のシステムによる強制終了の候補にはなりません
  • フォアグラウンドのサービスはステータスバーに通知を提供する必要があり、サービスは "継続中" にあるという位置付けになり、これはサービスが停止されるかフォアグラウンドから除去されない限りは、通知を片付けることができないということを意味します。

関連