Sdílet prostřednictvím


Application.OnCreate Method

Definition

Called when the application is starting, before any activity, service, or receiver objects (excluding content providers) have been created.

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

Remarks

Called when the application is starting, before any activity, service, or receiver objects (excluding content providers) have been created.

Implementations should be as quick as possible (for example using lazy initialization of state) since the time spent in this function directly impacts the performance of starting the first activity, service, or receiver in a process.

If you override this method, be sure to call super.onCreate().

<p class="note">Be aware that direct boot may also affect callback order on Android android.os.Build.VERSION_CODES#N and later devices. Until the user unlocks the device, only direct boot aware components are allowed to run. You should consider that all direct boot unaware components, including such android.content.ContentProvider, are disabled until user unlock happens, especially when component callback order matters.</p>

Java documentation for android.app.Application.onCreate().

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