-
Notifications
You must be signed in to change notification settings - Fork 107
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
I modified your plugin to enable android's PARTIAL_WAKELOCK #8
Comments
@boltex what is the benefit for using PARTIAL_WAKE_LOCK and when can I get your modifications. |
Well the benefits are that it lets the screen turn off so the behavior is that of a normal application: but the app still runs in the background when used in cunjunction with the background mode plugin. See :katzer/cordova-plugin-background-mode#93 Made my own solution, https://github.com/boltex/cordova-plugin-powermanagement I modified the power management plugin : I changed SCREEN_DIM_WAKE_LOCK to PARTIAL_WAKE_LOCK here's how i use it along with the background mode plugin so the app is never in background and always running as a service...(altough it does let the screen turn off and/or switch to other apps but your app will keep running and never miss a timer trigger): if( ionic.Platform.isAndroid() ){ window.powerManagement.dim(function() { } |
Thanks @boltex I will surely try your solution today and revert back with my results. |
@boltex I have a question, if I use your plugin along with the cordova-plugin-background will it enable me to wake up the phone and show my application screen when there is an event in my application. Similar to what happens when we receive a skype call and our phone is locked or in sleep mode, we are able to respond to the call even when our phone is locked. |
Hi, no I had no reason to not include this in the plugin. Can you create a pull request so that I can review your code and add it to the official code? |
Hi @Viras- , I really appreciate your work and his plugin in particular! :) I did only change SCREEN_DIM_WAKE_LOCK to PARTIAL_WAKE_LOCK in your code for the window.powerManagement.dim function in your /src/android/PowerManagement.java source. Because i am not fluent in java, nor in cordova plugin developpement, i did not try to offer it as a third choice. I only replaced the "dim wakelock" with "partial wakelock". It would be better if you added a third choice for the android platform such as a "window.powerManagement.partial" function. Thanks again! |
@zeeshanjan82 I am not sure because I have never tried to "wake up" the screen myself. |
I also use background mode and need a wake lock else background process gets to disappear. So i went for the Boltex implementation ( it works, thank you !) , but it could be great to have only 1 power management plugin implementing all the useful device abilities. As the current function accept other parameters with the JSON array, it should be easy to add a js function (partial) to call java with another parameter in order to adresse all modes without breaking the existing usages. https://github.com/boltex/cordova-plugin-powermanagement Thank you all. Bruno |
I will modify the plugin accordingly and will let you know once I have a new version ready. |
Thank you @Viras- !!!! |
Appreciate the good work, Viras and boltex!
@boltex, is this what you were facing and so you changed SCREEN_DIM_WAKE_LOCK to PARTIAL_WAKE_LOCK? I am not trying yoour version of powermanagement plugin to see if it works for me. |
@pm-deepak-dhage it will work if you use my version at https://github.com/boltex/cordova-plugin-powermanagement... and i modified the function dim. not aquire.
|
@boltex after acquiring wakelock the screen stays Active after implementing release function the screen is still in active state.it stays active until we terminate the app.Does the release function revokes the powermanagement.acquire()-if it does then it should come back to normal state then the screen should go inactive(OFF) as we mentioned in device settings for screen saver.! |
PARTIAL_WAKE_LOCK Wake lock level: Ensures that the CPU is running; the screen and keyboard backlight will be allowed to go off : If the user presses the power button, then the screen will be turned off but the CPU will be kept on until all partial wake locks have been released.
I was wondering if there was a reason you did not provide for this mode in the first place.... I tought this was a very useful in some instances... Is there an issue I might not be aware of? Something that made you not to include this choice with your powermanagement plugin?
The text was updated successfully, but these errors were encountered: