I have this problem.
when I call cordova.plugins.backgroundMode.moveToForeground(); It always works for me the first time, then I enter another application, for example Facebook, and this message is displayed in the logcat, what is it due to or how can I solve it?
I am using: https://github.com/FWiner/cordova-plugin-android-background-mode
This is the code that Cordova use for open app for to foreground:
private void moveToForeground()
{
Activity app = getApp();
Intent intent = getLaunchIntent();
intent.addFlags(
Intent.FLAG_ACTIVITY_REORDER_TO_FRONT |
Intent.FLAG_ACTIVITY_SINGLE_TOP |
Intent.FLAG_ACTIVITY_CLEAR_TOP);
clearScreenAndKeyguardFlags();
app.startActivity(intent);
}
Attached video of my problem with moveToForeground(): https://drive.google.com/file/d/1SQJ-6FNQ2Nr0nZxw7JBYwhGkYt9D33R_/view
VIDEO SUMMARY:
- I have the app open, then I exit.
- when running postman a service is sent and the app is brought to the foreground (which is the correct way)
- then I leave the app and enter facebook. I run postman and the app doesn't open in the foreground anymore (this is the bug I want to fix).
I am trying to open my application when it is in background mode, I have modified the moveToForeground() method and I have not had any results.