katzer / cordova-plugin-background-mode

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

WakeUp and unlock not working - with current Master branch #255

Closed nmaas87 closed 7 years ago

nmaas87 commented 7 years ago

I get following error:

"Uncaught TypeError: cordova.plugins.backgroundMode.wakeUp is not a function"

I checked out the current version of background-mode from this repo, however, this error is there. is that correct?

Alex-hv commented 7 years ago

@nmaas87 Look here: https://github.com/katzer/cordova-plugin-background-mode/issues/251

nmaas87 commented 7 years ago

@Alex2107 Thanks a lot for your kind hint - sorry I think I did not express myself correctly ^^'. So I actually did use the master branch as stated in the title - and I could also find the functions wakeUp and such implemented in the src code - so I should have the correct version - however, even despite the fact that it is in there - I still get the error. But after thinking about it - it could be that some old stuff is hanging back in the directory from the cleanup. So I will try from scratch and report back my findings. If the error persists, you will hear it - as well as if it was my / Intel XDKs shared fault ;).

nmaas87 commented 7 years ago

@Alex2107 I just did the test again with the current master repo - and the error persists:

03-01 21:03:35.716 19204 19204 I chromium: [INFO:CONSOLE(1127)] "Uncaught TypeError: cordova.plugins.backgroundMode.unlock is not a function", source: file:///android_asset/www/js/index.js (1127)

Somehow the function can't be called :(

nmaas87 commented 7 years ago

I have another idea what could have gone wrong, I am trying this today and submit my ideas and findings later :)!

nmaas87 commented 7 years ago

Ok, I got it finally working. I am using Intel XDK as tool - which is ok - but is really bad when it comes to plugins. I removed the background-mode plugin, installed it from git again - which worked - but XDK lied: It still kept the old files in some complie folders and used them.. hence the error. The correct work around was using phonegap directly to remove the plugin and adding it with phonegap (with the git version, yes). After that, the project needs to be recopied into the path of the XDK project folder and XDK needs to be restarted - will ask if it should use the newer version from the files or from its tracking. Just answer files and you'll be good to go :)! Sorry for interuption, again :(!