PowerOptimization provider causing error in browser #4611
Unanswered
kensentell
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Am using the plugin power-optimization for to control battery optimizations for Android, which works as expected when I run a real app on Android & iOS (doesn't do anything there, that's OK). However, when I run the app in a browser, where I do most of my basic testing, I get the following error in AppModule:
Error: Invalid provider for the NgModule 'AppModule' - only instances of Provider and Type are allowed, got: [..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ?[object Object]?, ..., ...]
I have added PowerOptimization as a provider so I can inject it into a service object I have for power management. I get the error as soon as I add the new provider to the AppModule and start the application.
I realize that the power optimization functions will not work in the browser and I am performing a check to see that I am running on Android before attempting any calls, so that is not the issue. I have tried placing the provider in the specific module where it is used, but that results in the same error there.
app.module.ts
I use the android-permissions plugin in the same app and this starts without issue. This is also valid only for Android. It would be nice to continue to test in the browser without having to comment out this code every time. Is this something with the plugin itself or am I doing something wrong? Any help is appreciated.
Beta Was this translation helpful? Give feedback.
All reactions