Android System Reboot rebootInstallPackage(final Context context, final File packageFile)

Here you can find the source of rebootInstallPackage(final Context context, final File packageFile)

Description

reboot Install Package

Declaration

public static void rebootInstallPackage(final Context context,
            final File packageFile) 

Method Source Code

//package com.java2s;
import java.io.File;
import java.io.IOException;
import android.content.Context;

import android.os.RecoverySystem;
import android.util.Log;

public class Main {
    private final static String TAG = "Upgrade.RebootUtils";

    public static void rebootInstallPackage(final Context context,
            final File packageFile) {
        Log.w(TAG, "!!! REBOOT INSTALL PACKAGE !!!");

        Log.d(TAG, "file path is " + packageFile.getPath());
        // The reboot call is blocking, so we need to do it on another thread.
        Thread thr = new Thread("Reboot") {
            @Override//from  ww w  .j a  v a2  s .  co  m
            public void run() {
                try {
                    RecoverySystem.installPackage(context, packageFile);
                } catch (IOException e) {
                    Log.e(TAG, "Can't perform rebootInstallPackage", e);
                }
            }
        };
        thr.start();
    }
}

Related

  1. rebootSystemNow()
  2. rebootNormal(Context context)
  3. rebootRecovery(Context context)
  4. rebootWipeUserData(final Context context)