JakeBullet70 Well-Known Member Licensed User Longtime User Jul 5, 2013 #1 I have been trying to put android asleep grammatically. I have tried: Code: Copy Dim p As Phone, n As Float = 0 p.SetScreenBrightness(n) This does seem to work but my app has problems restarting after this. Is there another way to do this?
I have been trying to put android asleep grammatically. I have tried: Code: Copy Dim p As Phone, n As Float = 0 p.SetScreenBrightness(n) This does seem to work but my app has problems restarting after this. Is there another way to do this?
Erel B4X founder Staff member Licensed User Longtime User Jul 5, 2013 #2 Which problem did you encounter later? Upvote 0
JakeBullet70 Well-Known Member Licensed User Longtime User Jul 5, 2013 #3 If I put the app asleep with the power button or wait for the android to put it asleep all is well, When I press the power button or a timer fires my app comes back fine. If I use the code above to put it asleep. The 1st time I press the power button nothing happens. 2nd time the screen powers up but displays nothing. 3rd time it goes blank again. 4th time most of my app comes back but some of the screen is not displayed. Has to be something different between me putting it asleep and the system doing it. Upvote 0
If I put the app asleep with the power button or wait for the android to put it asleep all is well, When I press the power button or a timer fires my app comes back fine. If I use the code above to put it asleep. The 1st time I press the power button nothing happens. 2nd time the screen powers up but displays nothing. 3rd time it goes blank again. 4th time most of my app comes back but some of the screen is not displayed. Has to be something different between me putting it asleep and the system doing it.
Erel B4X founder Staff member Licensed User Longtime User Jul 5, 2013 #4 Try to set the value to 0.1. Upvote 0
JakeBullet70 Well-Known Member Licensed User Longtime User Jul 5, 2013 #5 0.1 just dims the screen and when I press the power button it goes to sleep. I am going to create a small project, pull out the code and see if I can reproduce it in a small program. I did notice one other thing. When I press the power button to try and wake it up the 'Activity_Pause' keeps firing, I think thats why my app is having problems waking up. Upvote 0
0.1 just dims the screen and when I press the power button it goes to sleep. I am going to create a small project, pull out the code and see if I can reproduce it in a small program. I did notice one other thing. When I press the power button to try and wake it up the 'Activity_Pause' keeps firing, I think thats why my app is having problems waking up.
JakeBullet70 Well-Known Member Licensed User Longtime User Jul 5, 2013 #6 Here is a small sample that shows the problem. Fails on both my phone and tablet. Be careful with this program, it can lock you device up so that it needs to be re-started Attachments androidSleepProblem.zip androidSleepProblem.zip 6.6 KB · Views: 273 Last edited: Jul 5, 2013 Upvote 0
Here is a small sample that shows the problem. Fails on both my phone and tablet. Be careful with this program, it can lock you device up so that it needs to be re-started
Erel B4X founder Staff member Licensed User Longtime User Jul 7, 2013 #7 I tested it on a Nexus 4 and it works as expected. Note that the screen is not dimmed completely. There is a minimum brightness level. From what you are writing it seems that some devices do not handle a brightness level of 0 properly. Upvote 0
I tested it on a Nexus 4 and it works as expected. Note that the screen is not dimmed completely. There is a minimum brightness level. From what you are writing it seems that some devices do not handle a brightness level of 0 properly.
intera Member Licensed User Longtime User Jul 23, 2013 #8 Hi JakeBullet70 so far the only posibility I found was this.... http://www.b4x.com/android/forum/threads/reflection-library.6767/page-6#post-181521 but as says on th thread there is 2-3 sec delay.... if you find any better let me know please!!!! PS:I am looking for the gotosleep function of powermanager but it does not work unless you made it a system app....forget it Upvote 0
Hi JakeBullet70 so far the only posibility I found was this.... http://www.b4x.com/android/forum/threads/reflection-library.6767/page-6#post-181521 but as says on th thread there is 2-3 sec delay.... if you find any better let me know please!!!! PS:I am looking for the gotosleep function of powermanager but it does not work unless you made it a system app....forget it