katzer / cordova-plugin-background-mode

Keep app running in background
Apache License 2.0
1.38k stars 1.02k forks source link

neither setDefaults or configure apis are working any way possible #490

Open gzbakku opened 4 years ago

gzbakku commented 4 years ago

neither of the given api's are changing the notification text title or color

i implemented the plugin like this

cordova.plugins.backgroundMode.enable();
cordova.plugins.backgroundMode.configure({
  title: 'live on aaa',
  text:'close the app if you want to go offline on your aaa account.',
  color: 'ff0829',
  resume: true
});

cordova.plugins.backgroundMode.setDefaults({
  title: 'live on aaa',
  text:'close the app if you want to go offline on your aaa account.',
  color: 'ff0829',
  resume: true
});
cordova.plugins.backgroundMode.enable();

please guide us how to use it you are great

danieltanasec commented 4 years ago

I am facing the same issue on Android 9.1. I have tried both setDefaults() and configure() before and after backgroundMode.enable() or backgroundMode.on('activate').subscribe() but no luck unfortunately

amn31 commented 4 years ago

Same issue if I create my project wich 9.0.0 (cordova-lib@9.0.1)

RobertY9 commented 4 years ago

I was having the same issue, it appears that if a notification does not have a valid icon it ignores all of the defaults and doesn't work.

example here

danieltanasec commented 4 years ago

@gzbakku , @RobertY9 I confirm that I also solved the issue in the same way. The method getIconResId() in foreground service returns an error.

grumpygary commented 4 years ago

All settings must be valid or it will fail:

I'm pretty sure silent mode will fail. As a user, I like knowing that an app is running in the background.

BTW, from what I can tell, this plugin is really only useful for immediately resuming a session, instead of a cold-start. That said, that was what I was looking for at this point. It would be nice if I could do more things in the background, but such is the world of cordova open-source...