installAppSilently

suspend fun installAppSilently(appFile: File, onResult: (success: Boolean, message: String?) -> Unit)

Installs an APK file silently without user interaction.

This method is intended for use by device owner apps as it leverages APIs that require the app to be a device owner. It performs checks for device ownership, file validity, and handles the silent installation process using the Android PackageInstaller API.

Parameters

appFile

The APK file to be installed. The file must be readable and exist in the file system.

onResult

A callback function that is triggered with the result of the installation process. The callback provides a boolean indicating success or failure and an optional message detailing the result.