You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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