Class AndroidAvaloniaApplication<TUi>
Represents the Avalonia UI's application on Android: a head's application derives from it, says how its app starts
(CreateInitParams()), and carries only what the system reads, its [Application] attribute.
public abstract class AndroidAvaloniaApplication<TUi> : AvaloniaAndroidApplication<TUi>, IComponentCallbacks2, IComponentCallbacks, IJavaObject, IJavaPeerable, IDisposable where TUi : Application, IAvaloniaUi, new()
Type Parameters
TUiThe UI's application.
- Inheritance
-
AvaloniaAndroidApplication<TUi>AndroidAvaloniaApplication<TUi>
- Implements
- Inherited Members
-
AvaloniaAndroidApplication<TUi>.CreateAppBuilder()AvaloniaAndroidApplication<TUi>.CustomizeAppBuilder(AppBuilder)
Remarks
It starts the app before Avalonia: the platform, then the app's API handed to the UI, then Avalonia. Android makes it in every process of the package, the VPN service's and the Quick Settings tile's too, where neither the app nor Avalonia starts, as they would only lengthen those processes' start. A head that must do something before all this, as a crash reporter that starts in every process, overrides OnCreate() and calls this one after; its trackers it lists in the app's options.
Constructors
AndroidAvaloniaApplication(nint, JniHandleOwnership)
Represents the Avalonia UI's application on Android: a head's application derives from it, says how its app starts
(CreateInitParams()), and carries only what the system reads, its [Application] attribute.
protected AndroidAvaloniaApplication(nint javaReference, JniHandleOwnership transfer)
Parameters
javaReferencenintThe handle of the Java object.
transferJniHandleOwnershipHow the handle is owned.
Remarks
It starts the app before Avalonia: the platform, then the app's API handed to the UI, then Avalonia. Android makes it in every process of the package, the VPN service's and the Quick Settings tile's too, where neither the app nor Avalonia starts, as they would only lengthen those processes' start. A head that must do something before all this, as a crash reporter that starts in every process, overrides OnCreate() and calls this one after; its trackers it lists in the app's options.
Methods
CreateInitParams()
Creates the head's init params, asked for only in the app's own process.
protected abstract AppInitParams CreateInitParams()
Returns
- AppInitParams
The init params.
OnCreate()
Called when the application is starting, before any activity, service, or receiver objects (excluding content providers) have been created.
public override void OnCreate()
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().
Be aware that direct boot may also affect callback order on Android 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 ContentProvider, are disabled until user unlock happens, especially when component callback order matters.
Portions of this page are modifications based on work created and shared by the
Exceptions
- InvalidOperationException
The process's or the package's identity cannot be read; or, in the app's own process, Android names no cache folder, the init params name no storage folder, the platform has no local app data folder, Android names no folder kept out of backups, or a debug build's storage check fails.
OnTerminate()
This method is for use in emulated process environments.
public override void OnTerminate()
Remarks
This method is for use in emulated process environments. It will never be called on a production Android device, where processes are removed by simply killing them; no user code (including this callback) is executed when doing so. If you override this method you must call through to the superclass implementation.
Portions of this page are modifications based on work created and shared by the