Android 5.0 - how to wake up device display? Scienctific app - android

Question
Since there is only one Wake-Lock left with 5.0, what is the way to force the device to go out of standby for 2-5 Seconds and then go back black. No interaction, no unlock of keys... just out of standby. All solutions I found work with deprecated Wake-Locks.
I know it´s a bad idea and Google want to forbid it to me... do this for normal apps makes sense, but I work on a scientific app where I need it and can risk the battery drain.
Can I force a deprecated wake lock to work under a newer OS?
Why I need this?/What I do/2 Devices == Different behavoíour
I have a step counter, write the values to a sqlite db - at a alarm i look to the db and ask for the steps. based on this I do some magic.
Sony: With the Sony Xperia Z1 compact it works, because they don´t stop the sensors while Standby. So no batching.
Samsung: Same app, also step counter as sensor. But here I always get 0 steps when I ask for them in my alarm. A workaround: When I start the device out of standby for a moment and go to black again. My alarm can get the right value. And this is what I need. So I want to activate the display before I ask for the steps. Then the batched sensor data must be in the db and I get the right steps.
So any solutions? Wake-Locks over the service runtime, where my step counter is inside, are not working.
Big thank you, and I am sure for this case there is no duplicate Question. Get points and make me happy. Big Thank you for your help!

Related

Replace Android Screen Lock

I've made an app that has the unlock formatting that I want, but I don't know how to make it so that I can select that as the device security screen lock, or even if it is possible.
At the minute I have it so that when the phone is unlocked, the unlock app starts - however there is always a slight delay, and the app toolbar is visible at the top for a short period of time.
I've looked around for a very long time and not been able to find any resources on this other than with what I've already done, any help would be greatly appreciated.
(If it helps, the device I'm developing for is using Android 6.0.1)
Are you talking about a custom screen lock?
This may help.
https://github.com/Joisar/LockScreenApp
Okay in the LockScreenApp Activity class
every method call in the onAttachedWindow method needs to be moved to the onCreate method

HTC One: DropBoxManagerService goes haywire after upgrade to KitKat 4.4.2

I have noticed that the LOGCAT of my HTC One is getting flooded with messages from a "DropBoxManagerService" after I upgraded my device to Android KitKat 4.4.2.
I'm seeing this message repeated over and over again:
02-28 16:37:39.089 773-1376/? D/DropBoxManagerService﹕ Found time mapping 1393414988780 -> 1393414988780
It's outputting so fast that IntelliJ Idea's LOGCAT window is complaining: "Too much output to process". It can go on for hours before it settles down, and then starts again at some (apparently) arbitrary point in time.
I have tried to reset and disable the DropBox App, but it doesn't help. I'm suspecting this "infinite loop"-like behavior to be the culprit for a heavy battery drain issue, so I'm desperately trying to find a solution for the problem.
The service name is not getting listed by task-killer Apps.
Any good ideas are happily received!
I was told by a HTC Taiwan customer support manager that this is a bug of Google Play Service for Android 4.4.2 Kitkat, and all Android phone manufacturers like Samsung, Sony, etc. also suffers from this bug. (I wonder if it is true?) Please wait for update from Google.
I found this DropBoxManagerService message flooding bug will be triggered when there are new app updates available in Google Play Store. I can't see the update notification but my phone will become hot and battery drains fast. Reboot the phone will stop this flooding temporarily and Google Play Store will show update message immediately after reboot.
By the way, "Wipe cache partitions" does not work for me.
I tried reset htc one max to factory setting. It works.
The annoyed log will disappear.
You have to wipe the device's cache partition. After that the issue is solved as I noticed so far. No DropBoxManagerService flooding and no battery drain.
Hold power button and volume down key together until device powers off and you see black screen
Release power button only while you still keep holding down volume down key
Release volume down key when you see OS menu options
Use volume up/down keys to scroll and highlight "recovery" and press power button to select
When you see the icon that looks like a phone and orange "!" mark in a triangle, press power button and volume up key together once
It will display more options
Scroll to "wipe cache partitions" and press power button to select
Once wiping cache partitions is completed, select reboot

How to hold android device in dim-wakelock with disabled touchscreen?

I want to write an app that needs accelerometer data while the user has the device in his pocket. However, at least on my phone (Motorola Defy with a nightly CM9 build), a dim-wakelock is needed because the accelerometer somehow turns off together with the screen. But if the screen stays turned on, the user might trigger random touch actions with his body movements. I could just display a black area, but that won't protect the menu keys. So, what should I do to protect the device from accidential user interaction? Things that come to my mind:
use root access to somehow hook deep into the system and require an unlock pattern or so - but I as a user would hesitate to give an app root just because it wants to block my input, and if I as coder make a mistake, I might lock out users -> might work, but probably the worst possible solution
somehow use the lock screen for this - but I don't know how I can safely, whatever the settings on the device may be, activate that lock screen without needing root
Gah, this all just looks bad to me. Is there any way to solve this that doesn't suck?

Switch screen on by application (ANDROID, debug, all rights possible)

I read all there is about wake locks and so on. But I want something different. I have three devices to test, and mainly one device sucks really hard. Its the Asus transformer. The main problem, it can't be charged over USB. This means, if I tell it to "stay enabled during debug" the battery is dead after a while.
Also I want to write a small script deploying my app to all three devices once I build (no problem), starting them (no problem), and then ENABLE THE SCREEN (no way till now).
If found this intent, was happy for 23.5 seconds, and then read this:
http://developer.android.com/reference/android/content/Intent.html#ACTION_SCREEN_ON
Is there any way for me to enable the screen. The device is black, the screen is locked, my app starts (this works, seeing debug messages and hear startup sound), but i would have to manually unlock the screen.
I know, its not THAT bad, but when developing UIs I would have to do this like 100 times a day, and this is annyoing. The two little ones could stay on, but the big one (Transformer) would be empty after a while. I just had a thought, maybe I can tell the Transformer only to dim after a while, and to "undim" on startup. Would increase lifetime tenfold.
But still, if anyone knows a way to turn the screen on, that would be fantastic!
Chris
[UPDATE]
Ok, what you can do is reduce the screen brightness after some time, by using this:
WindowManager.LayoutParams WMLP = getWindow().getAttributes();
WMLP.screenBrightness = 0.01F;
getWindow().setAttributes(WMLP);
Dont use 0 as a value (at least not until this question is answered), because the screen will switch off, and you will never get in on again. At least without using your thumb and pressing a button, sooo oldschool...

Machine that can turn phone 90 degrees every few seconds?

I want to detect memory leaks in my Android application. Some leaks could be detected while rotating the phone physically so that the activities are constantly recreated.
I'm looking of some sort of physical device that could turn the phone 90 degrees every X seconds. I could build something using lego Mindstorm (that would actually be very cool), but I'm looking for something cheaper.
I also thought of using a clock, but I couldn't find one that has a clock second hand strong enough. Futhermore if the phone rotate 360 degrees after some time the USB cable would become too twisted. I think a device that goes back and forth between horizontal and vertical would be perfect.
My dream testing machine would also allow me to plug a USB cable so that I can run the Monkey tool while constantly rotating the phone.
Why don't you just force the orientation change or destroy and recreate the views every X seconds? I think it's more reliable than a mechanical approach. I can also recommend you this : http://developer.android.com/guide/developing/tools/monkey.html
You need to trigger configuration change somehow. This might be orientation change, hardware keyboard is opened or hidden, or any other change listed here: android:configChanges.
And there is one way to change configuration without using physical approach. You can use "Car Mode" or "Night Mode". Both only work in Android 8+ and can be turned on/off using UiModeManager.
So you can write your custom Service that will periodically call UiModeManager.enableCarMode(0) and UiModeManager.disableCarMode(0);, which in turn will force configuration changes in your Activity under test.
Perhaps http://mindstorms.lego.com/ Lego MindStorms? To be fair, it's about $250 so not really "throwaway cheap" but the advantage of being fully programmable might outweigh that.
As far as I know it's the cheapest robot kit out there which is why universities and schools use it.

Categories

Resources