Hello everyone, 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: GitHub - FWiner/cordova-plugin-android-background-mode: 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():
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).