Why does Android wait sometimes and sometimes work as expected? Why is the wait always about 30 seconds?
My tablet is a Lenovo A10-70F running Android version 5.0.1
Did you use Android Studio or some other IDE e..g Visual Studio? Yes, Eclipse
What do you get when you try profiling the app within an IDE? Never tried
If you reboot your device and then start the App does it still take 30 seconds to load? No. It's not the load time, its the time for the screen to come on after having been off for some time. The program is supposed to sense device rotation and turn on the screen at about 70 degrees to vertical.
I have not been able to correlate any event with when it takes 30 seconds.
Are you able to share the App with me? I have a Nexus 2013 7" tablet running Android 6.0.x and a phone running Android 6.0.x as well
Yes, here is a link to the apk file:
Here is the source: https://github.com/NormR/Wakeup
Thanks for the response. Good luck testing.
It is totally possible that once this project into Android Studio that the problem will be fixed. Google released Android Studio more then two years ago and it's 100% free for both personal and professional development.
Or if you don't want to use Android Studio you can use Microsoft Visual Studio
Microsoft released the latest Visual Studio for Android development early 2017 and it's 100% free for both personal and professional development.
I know that this may seem like a lot of work to migrate the Eclipse project to either Android Studio or Visual Studio, however I would say that this is the best place to go from here to fix the problem(s) you are experiencing.
Pete Letkeman wrote:Seeing as the App was created with Eclipse the first thing that I would recommend is that you migrate the App to Android Studio.
I'm with Norm. I use Eclipse for Android development and never seen any runtime problem caused by the IDE. Can you point to an case of where this happened?
When you import the project from Eclipse with ADT into Android Studio and/or Visual Studio the library references will should/would probably get updated. So instead of using something like the Android 4 support library version 20.15 (or whatever) you would be using the latest version of that library whatever that happens to be. Because the problem is occurring intermittently it may not be a problem with code that the user created, but the library that Google has provided. Google does update their libraries at least once every two months and bugs do get fixed. There is also a chance that one or more of the linters or plugins provided for Visual Studio or Android Studio does a better job then the comparable version with Eclipse. When the project is imported into Android Studio, Android Studio does many checks and some things could easily fixed (or broken for that matter),
Aside from all of the above, with Android Studio and I believe Visual Studio as well, you can quickly and easily emulate different devices with different screen sizes, storage space and RAM, which you could use. This could be used to quickly see what happens when you run out of RAM, just decrease what the emulated device has available. And you can rotate the display of the device or change the resolution/DPI. I know that this functionality was included with ADT, but with https://developer.android.com/studio/run/index.html the wait times have been drastically reduced for sending the changes to the emulated device to see your results.
Not only that Google is no longer supporting the ADT plugins with Eclipse per the announcement posted here https://developer.android.com/studio/tools/sdk/eclipse-adt.html
"The Eclipse ADT plugin is no longer supported, as per this announcement in June 2015.
The Eclipse ADT plugin has many known bugs and potential security bugs that will not be fixed."
I personally (and I'm not expert) would think that using the IDE recommended by Google for Android development would get you the best results.
For instance, and this is just a hypothetical here so please don't jump down my throat, but one of the files could be saved using UTF-8 instead of UTF-16. There could have been, and I'm not saying that there is, a problem with ADT or Eclipse when a file was saved or something like that. Or perhaps something was interrupted slightly wrong when the APK was created using ADT (again hypothetical). And yes I do realize that Google and/or Microsoft can and most likely have made left some bugs in Android Studio and Visual Studio, however I personally think that it would be better to use either of those to diagnose the problem.
I know that plenty of people still use Eclipse for a lot of development, including Android development, however if you are running into seemly random recurring problems then it's possible that the IDE you are using can be part of the problem, especially when it's not supported by the company what created it for the last two years or so.
Eclipse is free, Android Studio is free, Visual Studio is free, you only cost is the bandwidth, some hard drive space and your time learning the IDE for any of them.
All that aside, you should connect your device to your system to get diagnostic data from the Android debugger. Maybe when you get a better idea as to what is happening under the hood, thanks to the debugger, you'll see something like a variable isn't set correctly or that all of your memory is being used up for something else, etc who knows?
connect your device to your system to get diagnostic data from the Android debugger.
The problem is the problem does not happen very often. I can run the program for one or two days between the 30 second delays. I use the tablet many times a day for reading the news, etc.
I lay it down, leave it for a time and then pick it up to continue reading. Most of the time the screen comes on. Occasionally it takes 30 seconds before the screen comes on.
Did you try installing the program? What happened?
I click the button to start service.
I pressed the power button to dim the screen and put the device in standby mode. Same thing happens when the screen times out.
Woke up the device by flipping the cover, saw that the service was still running on as shown on the unlock screen.
Unlocked the device and then cancelled the service and exited the app.
Maybe I'm missing something here. You want your service to come to life when you move or rotate it? Android does this...at least Android 6. So what I'm a missing?
- Galaxy Tab S2 (API Level 24)
- Nexus 5 API (API Level 23)
The delay seems to increase after each attempt, with the tablet eventually not waking-up after 5 or 6 attempts.
The problem does not occur when monitoring logcat using adb.
Woke up the device by flipping the cover,
Not sure what that means. My tablet does not have a cover.
The program is supposed to wakeup the device.
start the app
normally spend time reading
lay the tablet done in a horizontal position and stop using any apps long enough that the display goes off.
wait a few minutes while the screen is dark
pick up the tablet and rotate it to a vertical position
The program should turn on the screen in a few seconds.
Did you turn on debug mode so the app writes debug info to a file?
The delay seems to increase after each attempt
That's different. For me the long delay is about 30 seconds every time. Not too much less or more (I estimate the time by counting one thousand one, one thousand two, etc)
Also the times written in the debug file are about 30-31 seconds from when the program wants to turn on the screen and when the screen is detected to be on.
Turned on screen with no delay:
Sensor values=[-0.249, 0.067, 9.816] cnt=60001 acc=0, hitCount=0 at T 18:46:05
Sensor values=[-0.162, 0.076, 9.778] cnt=70001 acc=0, hitCount=0 at T 19:08:24
WU Sensor values=[-7.489, -0.718, 2.585], haveShown=false, hitCount=1, cnt=79125 at T 19:28:43
Sensor values=[-7.489, -0.718, 2.585], since last=11125410, cnt=79126, hitCount=2 at T 19:28:43 <<<<<<<< Rotation detected
ScrnOnOffSrvc Turned on screen at T 19:28:43 ScreenOn=true <<<<<<<<<<<< 0 seconds after
Turned on after 31 seconds
Sensor values=[-0.21, -0.057, 9.826] cnt=60001 acc=0, hitCount=0 at T 09:22:01
WU Sensor values=[-7.613, 0.517, 2.911], haveShown=false, hitCount=1, cnt=66703 at T 09:37:18
Sensor values=[-8.14, 1.13, 3.237], since last=1828703, cnt=66704, hitCount=2 at T 09:37:18 <<<<<<< rotation detected
ScrnOnOffSrvc Turned on screen at T 09:37:49 ScreenOn=true <<<<<<<<<<<< NOTE 31 seconds after above