I am looking into how to keep my Android app running in the foreground.
It will be a privately distributed app, so I can do anything possible to make sure it runs consta
I solved that issue by having a sticky service running that relaunches the app when the activity is getting closed.
//Your activity
@Override
public void onPause() {
super.onPause();
if (yourservice != null) {
yourservice.validateActivityOnPause();
}
}
and in the validateActivityOnPause() have something like:
//Your service
public void validateLynxActivityOnPause() {
//Do some stuff here
Intent startActivityIntent = new Intent(this, LynxActivity.class);
startActivityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(startActivityIntent);
}