|
@@ -85,6 +85,8 @@ public class AppUpdateHelper {
|
|
return;
|
|
return;
|
|
}*/
|
|
}*/
|
|
|
|
|
|
|
|
+ restartAppLater(context, 60000);
|
|
|
|
+
|
|
String path = FILE_APK_PATH + "/" + FILE_APK_NAME;
|
|
String path = FILE_APK_PATH + "/" + FILE_APK_NAME;
|
|
//if (installApp(context.getPackageName(), path)) {
|
|
//if (installApp(context.getPackageName(), path)) {
|
|
if (rootSilenceInstall(path)) {
|
|
if (rootSilenceInstall(path)) {
|
|
@@ -228,6 +230,16 @@ public class AppUpdateHelper {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static void restartAppLater(Context context, int time) {
|
|
|
|
+ //重新启动app
|
|
|
|
+ Intent mStartActivity = new Intent(context.getApplicationContext(), WelcomeActivity.class);
|
|
|
|
+ mStartActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
|
|
+ int mPendingIntentId = 123456;
|
|
|
|
+ PendingIntent mPendingIntent = PendingIntent.getActivity(context.getApplicationContext(), mPendingIntentId, mStartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
|
|
|
|
+ AlarmManager mgr = (AlarmManager) context.getApplicationContext().getSystemService(Context.ALARM_SERVICE);
|
|
|
|
+ mgr.set(AlarmManager.RTC, System.currentTimeMillis() + time, mPendingIntent);
|
|
|
|
+ }
|
|
|
|
+
|
|
public static void reboot(Context context) {
|
|
public static void reboot(Context context) {
|
|
Log.e(TAG, "start reboot device...");
|
|
Log.e(TAG, "start reboot device...");
|
|
try {
|
|
try {
|