Open JessicaMouta opened 4 years ago
In attach a simple test (.ts and .html files) I used to test the plugin with Android 8 and 9. Simply, it run a counter so you can see if it works in background or not.
I hope it help. home.page.zip
The problem is it seems that the plugin works only for a while, in my tests it lasted up to an hour, but then it closes .. my app needs to do a pooling to keep a company online and receive orders.
a function: this.bkgng.moveToBackground(); makes any difference?
Make sure you don't disable the running notification.
Don't use this:
cordova.plugins.backgroundMode.setDefaults({ silent: true });
Hey,
Did you find something which keeps the app running ?
I have a similar requirement - Delivery app - suppliers wants continuous bell even if app is closed till action
Please guide me as you have already tried all this How did you manage this ?
I was having the same problem. I manage to fix it by doing:
cordova.plugins.backgroundMode.on('activate', function() {
cordova.plugins.backgroundMode.disableWebViewOptimizations();
});
I was having the same problem. I manage to fix it by doing:
cordova.plugins.backgroundMode.on('activate', function() { cordova.plugins.backgroundMode.disableWebViewOptimizations(); });
where do you put this event ?
I have put it like this:
cordova.plugins.backgroundMode.enable();
setTimeout(function() {
cordova.plugins.backgroundMode.on('activate', function() {
console.log('backgroundMode ACTIVE: '+cordova.plugins.backgroundMode.isActive());
cordova.plugins.backgroundMode.disableWebViewOptimizations();
setTimeout(function() {
cordova.plugins.backgroundMode.configure({
title: "MyApp",
text: "The app is running in the background...",
resume: true,
hidden: true,
bigText: false
});
},2000);
});
cordova.plugins.backgroundMode.on('deactivate', function() {
console.log('backgroundMode INACTIVE: '+cordova.plugins.backgroundMode.isActive());
});
},1000);
(However, changing the notification parameters doess not work.)
I was having the same problem. I manage to fix it by doing:
cordova.plugins.backgroundMode.on('activate', function() { cordova.plugins.backgroundMode.disableWebViewOptimizations(); });
I'm try this event ,But the app will be called every time when switching to another app Makes it impossible to use other apps easily
The plugin does not work in the background for more than 30 minutes. My code is this: init() { this.platform.ready().then(() => { this.activeBackgroundMode(); this.powerManagement.dim(); this.powerManagement.setReleaseOnPause(false); }); } activeBackgroundMode(){ this.backgroundMode.enable(); this.backgroundMode.on('activate').subscribe(() => { this.backgroundMode.disableWebViewOptimizations(); this.backgroundMode.disableBatteryOptimizations();
already updated the plun but contained not working.
Can someone help me!!