katzer / cordova-plugin-background-mode

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

Can't install plugin on cordova 9 #441

Open reitererm opened 5 years ago

reitererm commented 5 years ago

Hi!

I can't install this plugin on a cordova 9.0.0 project. I just can see the start of a warning:

E:\Cordova9>cordova -v 9.0.0

E:\Cordova9>cordova plugin add cordova-plugin-background-mode Installing "cordova-plugin-background-mode" for android warn

E:\Cordova9>

Best regards Michael

reymonreyes commented 5 years ago

I was also having the same issue. The plugin does appear on the list when I do "cordova plugins". That is probably the reason why I'm having "Uncaught TypeError: Cannot read property 'backgroundMode' of undefined".

Rindegastos commented 5 years ago

We are having the same problem...

C:\Projects\pp\test>ionic cordova plugin add cordova-plugin-background-mode

cordova plugin add cordova-plugin-background-mode --save Installing "cordova-plugin-background-mode" for android warn

C:\Projects\pp\test>

xam8re commented 5 years ago

same problem for ios

strike56 commented 5 years ago

I have some probem too.

f18nfz commented 5 years ago

Yeah got the same problem when trying to re-add the plugin - (the src etc doesn't get added). I had a copy of the plugin on my machine which works well - so a workaround could be to manually download the plugin off the git and add from your local machine?

nnez commented 5 years ago

Hey everyone! I'm too face this problem when trying to install this plugin in Cordova 9.0.0. However, I just found a way to make it work despite I don't know why doing this make this work.

Just delete the following line in plugin.xml <engine name="windows-sdk" version=">=10.0.14393.0" />

bauyrzhanospan commented 5 years ago

Hey everyone! I'm too face this problem when trying to install this plugin in Cordova 9.0.0. However, I just found a way to make it work despite I don't know why doing this make this work.

Just delete the following line in plugin.xml <engine name="windows-sdk" version=">=10.0.14393.0" />

But I have the same issue in Mac OS.

Installing "cordova-plugin-background-mode" for android warn CordovaError: warn at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:230:23 at Array.forEach (<anonymous>) at getEngines (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:208:13) at Function.runInstall (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:285:22) at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:76:35 at process._tickCallback (internal/process/next_tick.js:68:7) at Function.Module.runMain (internal/modules/cjs/loader.js:757:11) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

strike56 commented 5 years ago

Hey everyone! I'm too face this problem when trying to install this plugin in Cordova 9.0.0. However, I just found a way to make it work despite I don't know why doing this make this work.

Just delete the following line in plugin.xml <engine name="windows-sdk" version=">=10.0.14393.0" />

Confirmed! For Android.

lonelyls commented 5 years ago

For me, I had to change the plugin.xml and change <source-file src="src/android/BackgroundModeExt.java" target-dir="src/de/appplant/cordova/plugin/background" /> to <source-file src="src/android/BackgroundExt.java" target-dir="src/de/appplant/cordova/plugin/background" />

jeanlandim commented 5 years ago

Hey everyone! I'm too face this problem when trying to install this plugin in Cordova 9.0.0. However, I just found a way to make it work despite I don't know why doing this make this work.

Just delete the following line in plugin.xml <engine name="windows-sdk" version=">=10.0.14393.0" />

aparently work here

ghost commented 5 years ago

Not working for me. ¿Can you fix that bug? Thank you very much.

samsagaz commented 5 years ago

Hey everyone! I'm too face this problem when trying to install this plugin in Cordova 9.0.0. However, I just found a way to make it work despite I don't know why doing this make this work.

Just delete the following line in plugin.xml <engine name="windows-sdk" version=">=10.0.14393.0" />

Thanks Works!

ghost commented 5 years ago

I tried it but it does not work

philipjbrowning commented 5 years ago

Deleting the line below works, as others said. The rest of the windows code is commented out. <engine name="windows-sdk" version=">=10.0.14393.0" />

iomJvaranam commented 5 years ago

For me, I had to change the plugin.xml and change <source-file src="src/android/BackgroundModeExt.java" target-dir="src/de/appplant/cordova/plugin/background" /> to <source-file src="src/android/BackgroundExt.java" target-dir="src/de/appplant/cordova/plugin/background" />

this file "BackgroundExt.java" not exist in 0.7.2 version. any alternative fix?

sercatven commented 5 years ago

For me, I had to change the plugin.xml and change <source-file src="src/android/BackgroundModeExt.java" target-dir="src/de/appplant/cordova/plugin/background" /> to <source-file src="src/android/BackgroundExt.java" target-dir="src/de/appplant/cordova/plugin/background" />

this file "BackgroundExt.java" not exist in 0.7.2 version. any alternative fix?

my fork fix cordova 9

https://github.com/sercatven/cordova-plugin-background-mode

Rindegastos commented 5 years ago

How can I install de plugin without de Cordova-CLI so I can delete the indicated windows line of code?

hungtranqn commented 5 years ago

For me, IONIC 4

iget-master commented 5 years ago

Same issue here, seems to be related to the windows-sdk line on plugin.xml.

Can someone fix it?

SanjanaTailor commented 5 years ago

@sercatven : still facing same issue for Background Mode plugin not installed error

inDivyanshu commented 5 years ago

For me, IONIC 4

  • run: cordova plugin add cordova-plugin-background-mode normal
  • $root_dir/plugins/cordova-plugin-background-mode/plugin.xml delete line <engine name="windows-sdk" version=">=10.0.14393.0" />
  • run: ionic cordova platform rm android ; ionic cordova platform add android
  • done

Does it work for ios too?

SanjanaTailor commented 5 years ago

@Divyanshu30 : I am using ionic3. I also delete the line in plugin.xml but when I say this.backgroundMode.on('Activate') error showing for me Plugin not installed

SanjanaTailor commented 5 years ago

@All : I uninstall cordova version 9.0 and tried to install cordova version 8 and installed plugin called Background Mode and no error shown and working fine

aperrone commented 5 years ago

I have the same problem with Cordova 9 & iOS. I'm waiting for the solution. I hope it arrives early because I can't release the app.

Rindegastos commented 5 years ago

It is going to be almost 2 months since this error appearded. Is there a way to fix it? I think the pull requests are still waiting there.

tonnymedina commented 5 years ago

Hey everyone! I'm too face this problem when trying to install this plugin in Cordova 9.0.0. However, I just found a way to make it work despite I don't know why doing this make this work.

Just delete the following line in plugin.xml <engine name="windows-sdk" version=">=10.0.14393.0" />

works for me! Thanks

aperrone commented 5 years ago

It works but only on iphone simulator; not on real device!

tonnymedina commented 5 years ago

It works but only on iphone simulator; not on real device!

that just happened to me. please help

falquinho commented 5 years ago

For me, I had to change the plugin.xml and change <source-file src="src/android/BackgroundModeExt.java" target-dir="src/de/appplant/cordova/plugin/background" /> to <source-file src="src/android/BackgroundExt.java" target-dir="src/de/appplant/cordova/plugin/background" />

this file "BackgroundExt.java" not exist in 0.7.2 version. any alternative fix?

my fork fix cordova 9

https://github.com/sercatven/cordova-plugin-background-mode

This fork worked for me. My environment is Ionic 4 and Android 9.0. Also note that you need to call disableWebviewOptmizations for your app to actually keep running on background. Thanks @sercatven . Also, please @katzer , accept the PR's to fix these bugs.

mikenetcode commented 5 years ago

452

mikenetcode commented 5 years ago

Hey everyone! I'm too face this problem when trying to install this plugin in Cordova 9.0.0. However, I just found a way to make it work despite I don't know why doing this make this work.

Just delete the following line in plugin.xml <engine name="windows-sdk" version=">=10.0.14393.0" />

Worked for me, thanks a lot!

P.S.: Only works with cordova-plugin-background-mode version: 4c157f4 (= commit of Feb 3, 2019). If i use the latest version i do not get errors, but background mode never gets activated.

Rindegastos commented 5 years ago

Is there a fork that we can use in ionic instead of this plugin? Cant beleive that in all this time the issue and pull requests are still there

tonnymedina commented 5 years ago

Delete the next line in plugin.xml

only works on virtual device. You could remove the webview plugins for ionic if you do not need it. this worked for me

NicolasHz commented 5 years ago

For me, IONIC 4

  • run: cordova plugin add cordova-plugin-background-mode normal
  • $root_dir/plugins/cordova-plugin-background-mode/plugin.xml delete line <engine name="windows-sdk" version=">=10.0.14393.0" />
  • run: ionic cordova platform rm android ; ionic cordova platform add android
  • done

You're the boss! many thanks!

fdambrosio commented 4 years ago

i have the same problem

fnrol commented 4 years ago

+1

davidtoledo commented 4 years ago

For me, I had to change the plugin.xml and change <source-file src="src/android/BackgroundModeExt.java" target-dir="src/de/appplant/cordova/plugin/background" /> to <source-file src="src/android/BackgroundExt.java" target-dir="src/de/appplant/cordova/plugin/background" />

this file "BackgroundExt.java" not exist in 0.7.2 version. any alternative fix?

my fork fix cordova 9

https://github.com/sercatven/cordova-plugin-background-mode

it works. thanks!

muhammadtalhaishtiaq commented 1 year ago

it didn't work for me, in plugins for cordova background mode, this line was not there

but I still rm android platform and again added that. But still not working, still getting the following issue,

vendor.js:51847 ERROR Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'enable')
TypeError: Cannot read properties of undefined (reading 'enable')
    at Channel.<anonymous> (main.js:939:61)
    at Channel.subscribe (cordova.js:802:21)
    at document.addEventListener (cordova.js:125:34)
    at document.addEventListener (cordova.js:1460:13)
    at AppComponent.<anonymous> (main.js:932:46)
    at step (vendor.js:106845:23)
    at Object.next (vendor.js:106826:53)
    at vendor.js:106819:71
    at new ZoneAwarePromise (polyfills.js:3272:29)
    at Module.__awaiter (vendor.js:106815:12)
    at resolvePromise (polyfills.js:3193:31)
    at new ZoneAwarePromise (polyfills.js:3275:17)
    at Module.__awaiter (vendor.js:106815:12)
    at main.js:923:100
    at push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (polyfills.js:2785:31)
    at Object.onInvokeTask (vendor.js:53413:33)
    at push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (polyfills.js:2784:60)
    at push../node_modules/zone.js/dist/zone.js.Zone.runTask (polyfills.js:2557:47)
    at push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask (polyfills.js:2860:34)
    at ZoneTask.invoke (polyfills.js:2849:48)
defaultErrorLogger @ vendor.js:51847

Can you help me out please ?And anyone else can help also pl. Thanks.

My project versions : ionic: 4.11.13 angular : 7.2.4 @ionic-native/background-mode: "^5.0.0-beta.24", project type: angular