how do i restart my android app in firemonkey?

  

i wanted to restart my android app when onDestroy event called

i tried to do something like this

RIntent :=TJIntent.Create;
RIntent.setClass(TAndroidHelper.Context.getPackageManager().getLaunchIntentForPackage(TAndroidHelper.Context.getPackageName()));
RIntent.addFlags(TJIntent.JavaClass.FLAG_ACTIVITY_CLEAR_TOP);
RIntent.addFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK);
TAndroidHelper.Context.startActivity(RIntent);

MainActivity.finish;

i got this error

[DCC Error] form1.pas(5106): E2010 Incompatible types: ‘JContext’ and
‘JIntent’

then i tried to do something like following

RIntent :=TJIntent.Create;
RIntent := TAndroidHelper.Context.getPackageManager().getLaunchIntentForPackage(TAndroidHelper.Context.getPackageName());
RIntent.addFlags(TJIntent.JavaClass.FLAG_ACTIVITY_CLEAR_TOP);
RIntent.addFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK);
TAndroidHelper.Context.startActivity(RIntent);

MainActivity.finish;

but the app did not restarted its just closed

Comments are closed.