-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'cordova.plugins.backgroundMode.onactivate is not a function' in Ionic 3 app #431
Comments
See pull request - #423 |
@i91 I'm seeing this issue on iOS. |
Fixed in pull request #433 |
Same problem on Android |
You can solve this (until contributors merge @daviddickson PR) by running:
If you're not using Ionic just remove Hope It helps :D |
I just tried @daviddickson's fork now, but I do my initial dev using an Android device, so after I had the same error I took a closer look at that fork and noticed it only includes changes for iOS. since @fyayc-chrisat's fork covers the Android side, but was forked from an earlier point (6 commits behind the source repo), I simply applied the Android looking through the commits in this repo since the latest @katzer I do see that they were already marked as "deprecated", but could you perhaps shed some light on this? from my testing, this error doesn't seem to break any functionality in either Android or iOS, but the |
actually, I think we might be going down the wrong path here altogether... PR 423 is trying to print out a string as so now I'm even more confused by which way this whole thing is going. :/ |
Is there any plan to merge @daviddickson pull request? I see there is a fix through his fork, but is this something that's being tested to merge with the master @katzer ? |
@fax1ty I'm testing with beta users now and until now it's working. Added to the disable batery optimizations. |
Thanks @lkonzen-garupa . I'm trying your fork right now... I have This is great if for me because I hated having that notification required to be there. However, before using your fork, the background audio of my app would always cut out after moving to background, unless I made the notification appear with How did you fix this so the notification is not needed anymore? |
@rastographics about audio I don't change anithing. I just use the plugin https://github.com/floatinghotpot/cordova-plugin-nativeaudio. All is working and playing fine, even when in background. On device is ready:
When I need to play that audio:
|
I'm using When using katzer's plugin, there is a constant notification created that keeps the app from dying. With your fork, the errors go away, but so does the constant notification, so the app dies after being in background for 10-12 minutes and the audio stops. I know your plugin does not change anything with the audio...but something is done different that does not create that notification which keeps the app from being killed after long time. Does that make sense? |
I understand. But, in my case, it still showing the notification for a long time. |
@lkonzen-garupa have you solved this issue? I have the same issue... |
@n1705771 it's all working fine. |
@lkonzen-garupa My test environment is android 8 running on a moto g6. Is there any code to call besides |
@rastographics In m case, the prompt just occur if I execute that following comand:
And I use just when needed to enable the background.
|
Maybe:
@n1705771 How did you solved 'cordova.plugins.backgroundMode.onactivate is not a function' ? I installed https://github.com/lkonzen-garupa/cordova-plugin-background-mode and add the code for wake_lock Is working for android 5, 7 and 10 :-) |
I can't get this to work on device with iOS 12. I got rid of the error I also tried what @zhangxiongwang suggested on #450 but I'm still unsuccessful. Someone experiencing the same issue? |
Exact same problem here, it just doesn't work on IOS. Would love a solution. |
thanks |
Thats the problem: using a forked version is always the solution |
So I took all those changes and the ones posted on https://github.com/lkonzen-garupa/cordova-plugin-background-mode and made a new fork https://github.com/platanus/cordova-plugin-background-mode. The weird thing is that it works on ios only when cordova-plugin-background-geolocation is activated. any guess? |
Nevermind.. I was missing the "Audio" capabilitie in background modes.. Now it works perfectly! |
I did a fresh install of this plugin using the Ionic V3 instructions (https://ionicframework.com/docs/v3/native/background-mode/). When I try to run the app in the simulator or device I get
TypeError: cordova.plugins.backgroundMode.onactivate is not a function. (In 'cordova.plugins.backgroundMode.onactivate()', 'cordova.plugins.backgroundMode.onactivate' is undefined
when I try to put the app in the background. It sees the subscription to the enable correctly. Any suggestions as to what is going wrong? I've the necessary import to app.module.ts.Here is the code that is in the app.component.ts
The text was updated successfully, but these errors were encountered: