Compartilhar via


RecoverySystem.InstallPackage(Context, File) Method

Definition

Reboots the device in order to install the given update package.

[Android.Runtime.Register("installPackage", "(Landroid/content/Context;Ljava/io/File;)V", "")]
[Android.Runtime.RequiresPermission("android.permission.RECOVERY")]
public static void InstallPackage (Android.Content.Context? context, Java.IO.File? packageFile);
[<Android.Runtime.Register("installPackage", "(Landroid/content/Context;Ljava/io/File;)V", "")>]
[<Android.Runtime.RequiresPermission("android.permission.RECOVERY")>]
static member InstallPackage : Android.Content.Context * Java.IO.File -> unit

Parameters

context
Context

the Context to use

packageFile
File

the update package to install. Must be on a partition mountable by recovery. (The set of partitions known to recovery may vary from device to device. Generally, /cache and /data are safe.)

Attributes

Exceptions

if writing the recovery command file fails, or if the reboot itself fails.

Remarks

Reboots the device in order to install the given update package. Requires the android.Manifest.permission#REBOOT permission.

Java documentation for android.os.RecoverySystem.installPackage(android.content.Context, java.io.File).

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