Share via


Service.OnDestroy Method

Definition

Called by the system to notify a Service that it is no longer used and is being removed.

[Android.Runtime.Register("onDestroy", "()V", "GetOnDestroyHandler")]
public virtual void OnDestroy ();
[<Android.Runtime.Register("onDestroy", "()V", "GetOnDestroyHandler")>]
abstract member OnDestroy : unit -> unit
override this.OnDestroy : unit -> unit
Attributes

Remarks

Called by the system to notify a Service that it is no longer used and is being removed. The service should clean up any resources it holds (threads, registered receivers, etc) at this point. Upon return, there will be no more calls in to this Service object and it is effectively dead. Do not call this method directly.

Java documentation for android.app.Service.onDestroy().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to