@@ -299,17 +299,16 @@ export class AppSync {
299
299
private static killApp ( restartOnAndroid : boolean ) : void {
300
300
if ( Application . android ) {
301
301
if ( restartOnAndroid ) {
302
+ const packageManager = Application . android . context . getPackageManager ( ) ;
303
+ const intent = packageManager . getLaunchIntentForPackage ( Application . android . context . getPackageName ( ) ) ;
304
+ const componentName = intent . getComponent ( ) ;
305
+
302
306
//noinspection JSUnresolvedFunction,JSUnresolvedVariable
303
- const mStartActivity = new android . content . Intent ( Application . android . context , Application . android . startActivity . getClass ( ) ) ;
304
- const mPendingIntentId = parseInt ( "" + ( Math . random ( ) * 100000 ) , 10 ) ;
305
- //noinspection JSUnresolvedFunction,JSUnresolvedVariable
306
- const mPendingIntent = android . app . PendingIntent . getActivity ( Application . android . context , mPendingIntentId , mStartActivity , android . app . PendingIntent . FLAG_CANCEL_CURRENT ) ;
307
- //noinspection JSUnresolvedFunction,JSUnresolvedVariable
308
- const mgr = Application . android . context . getSystemService ( android . content . Context . ALARM_SERVICE ) ;
309
- //noinspection JSUnresolvedFunction,JSUnresolvedVariable
310
- mgr . set ( android . app . AlarmManager . RTC , java . lang . System . currentTimeMillis ( ) + 100 , mPendingIntent ) ;
307
+ const mainIntent = new android . content . Intent . makeRestartActivityTask ( componentName ) ;
308
+ Application . android . context . startActivity ( mainIntent ) ;
311
309
//noinspection JSUnresolvedFunction,JSUnresolvedVariable
312
310
}
311
+ //noinspection JSUnresolvedFunction,JSUnresolvedVariable
313
312
android . os . Process . killProcess ( android . os . Process . myPid ( ) ) ;
314
313
} else if ( Application . ios ) {
315
314
exit ( 0 ) ;
0 commit comments