cordova-plugin-background-mode icon indicating copy to clipboard operation
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

Open n1705771 opened this issue 3 years ago • 3 comments

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();

n1705771 avatar Jul 07 '21 13:07 n1705771

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 avatar Jul 15 '21 08:07 Maxime145

@Maxime145 Thanks for help. It doesn't work. My Cordova version is 10.0.0.

n1705771 avatar Aug 15 '21 00:08 n1705771

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.

Maxime145 avatar Sep 10 '21 06:09 Maxime145