cordova-plugin-background-mode
cordova-plugin-background-mode copied to clipboard
ionic 5 background icon shows “tap for more information or to stop the app” and cannot open the app by tapping
I use cordova background plugin in my ionic 5 application. When application runs in the background, the background icon shows "tap for more information or to stop the app". I want to open the application by tapping the backgound icon, but it always dircts to the App info page.
Below is the code for setting the background options. Could you please check what is the problem?
const options = {
title: 'MyApp',
text: 'Running in Background Mode',
hidden: false,
silent: false,
sticky: true,
resume: true,
foreground: false,
};
cordova.plugins.backgroundMode.setDefaults(options);
cordova.plugins.backgroundMode.enable();
What is the version of your cordova plugin ?
Because I have never seen these settings for the background-mode notification (sticky and foreground).
Other than that, it looks like you're calling the "setDefaults ()" the right way.
Maybe try this ?
cordova.plugins.backgroundMode.setDefaults({
title: 'MyApp',
text: 'Running in Background Mode',
hidden: false,
silent: false,
// sticky: true,
resume: true,
// foreground: false,
});
cordova.plugins.backgroundMode.enable();
@Maxime145 Thanks for help. It doesn't work. My Cordova version is 10.0.0.
I did not receive a notification so sorry for the delay.
If your project is still relevant, have you tested this plugin ==> TheBosZ ?
It is a modified version, it allows a little more thing and fixed some instabilities, In particular, opening the application by clicking on the notification.