|
@@ -157,6 +157,18 @@ public class AppUpdateHelper {
|
|
printWriter.println("pm install -r " + path);
|
|
printWriter.println("pm install -r " + path);
|
|
printWriter.flush();
|
|
printWriter.flush();
|
|
printWriter.close();
|
|
printWriter.close();
|
|
|
|
+
|
|
|
|
+ Intent intent = new Intent(BaseApplication.appContext, WelcomeActivity.class);
|
|
|
|
+ PendingIntent restartIntent = PendingIntent.getActivity(BaseApplication.appContext, 0, intent, PendingIntent.FLAG_ONE_SHOT);
|
|
|
|
+ AlarmManager mgr = (AlarmManager) BaseApplication.appContext.getSystemService(Context.ALARM_SERVICE);
|
|
|
|
+
|
|
|
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {// 6.0及以上
|
|
|
|
+ mgr.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 45000, restartIntent);
|
|
|
|
+
|
|
|
|
+ } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {// 4.4及以上
|
|
|
|
+ mgr.setExact(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 45000, restartIntent);
|
|
|
|
+ }
|
|
|
|
+
|
|
int res = process.waitFor();
|
|
int res = process.waitFor();
|
|
Log.e(TAG, "silent install res: " + res);
|
|
Log.e(TAG, "silent install res: " + res);
|
|
if (res == 0) {
|
|
if (res == 0) {
|