How to get total CPU time for android app - java

Ideal cpu percent for android app
I used to see the break down of battery usage about 5 weeks ago similar to the above topic's answer with CPU total, CPU foreground, GPS (because my app use GPS), and Computed power usage. However, after an auto update, the Battery Usage now shows only While in active use and While in background which is pretty much useless information and it does not even track the time my app use in the background properly (always 0 minutes even after running in the background for 16 hours - I checked the log to verify this).
Ideally, I would like either see the detailed breakdown again so I know exactly how much total time was requested for each category. Should I flash an earlier version of android or just install the right Settings apk file? If so, could you please tell me your Settings's version?
Not ideally, I can get the cpu usage break down through adb shell /system/bin/dumpsys cpuinfo, however I cannot control the time I want to sample like using the previous setting app (full charging & unplug would start the timer). Anyone have experience using adb to specify which time range I would like to query CPU time from?

Related

How to Hide Android Application from Task Manager/ not recent apps tab

I'm using a SG Note 4 and when I open the Google Maps app and then go to task manager it never shows up, it does when you go to settings, applications, cached..., how can I achieve the same with my app. Im using a map fragment and when moving the camera the cache increases and increases, I imagine people with little knowledge going to task manager and seeing my app using 500mb of ram might end up getting scared and kill it, or worse uninstalling it. Maybe not all manufacturers give users this option but for those that do how can I do this if it's even possible thanks!!

Android Wear - Enable / Disable Ambient mode Programmatically

I have in the past developed some small Android Apps, and have recently gotten an LG G Watch, and absolutely love it.
Right now, the only issue with the device is that it lasts about a day and a half in ambient mode.
What I am looking to be able to do is through software, enable and disable the ambient mode on the device. In doing this, we will be able to turn it off at specific times, i.e. at night.
The advantage of being able to do this is both save the display, and by turning ambient mode off at night, I only need to charge the device every other day, but it is just an inconvenience to enable / disable every day.
I have the Java / Android experience to build the app, but the question I have is essentially the whole thing:
How can I, in code, enable and disable ambient mode?
Is this possible? I spent some time googling, and been unable to find an answer. Has anyone used the wearable API? And is there anything in it that would allow something like this?
It is not possible to disable ambient mode programatically. However, you don't need to do what you are describing. The device detects that is not worn and after 30 minutes it will turn the screen off completely, including turning off ambient mode.
If you are a AOSP programmer, modify AmbientService to call finish() from AmbientDream, if you are a app programmer, sorry there's no API for what you want.

Why might my android app occasionally drain battery extremely fast?

Several users of my app have reported their battery draining at around 1% a minute with my app running in the background. I have been unable to replicate this issue even when using the same account credentials on the same device model that the user had the error on. Reinstalling the app apparently does not solve the problem, and there does not seem to be any specific Android version or device associated with the issue. All the reports I've had are Samsung devices running 4.x, but this is also fairly representative of my user base overall. My background service listens for GCM messages and contact list changes as well as firing off an http request roughly every hour using a ScheduledExecutorService.
I should also note that I do not use any wake locks in the app.
I am wondering if anyone has any ideas as to what sorts of bugs might cause an issue like this, or even what tools or methods might be effective in narrowing down my problem scope.
About what percentage of users are reporting this problem? If you tried it on a Samsung device running 4.x and you didn't get an issue something besides your code must be the problem.
If I were you I'd
Start testing with your wifi turned off.
Test your application while simulating high latency (Charles
has a free 30-days trial)
And add some code for monitoring battery level and charging
state.
I'm sorry I don't a better answer.

App Engine charts show zero activity although no errors reported?

I am testing out a new app and noticed whilst looking at my reports that for a period of approximately 1 hour all charts showed zero activity. I.e. Requests/Second, CPU Seconds Used, Instances all display zero, when they shouldn't be as the app receives a constant supply of traffic. Note: Error/Second shows no errors for that time period.
This screenshot conveys this:
I have looked in my logs and during that period it shows I still received traffic and requests were handled successfully - which is puzzling.
Has anyone else noticed such an anomaly or is this likely to be an issue with my app!
Thanks
This is almost certainly a reporting issue - your site was getting traffic, and serving it fine, but the infrastructure that collects stats failed to do so for a short while. Check your logs to confirm.
It happen to me today ~(6/11/2011) also, I think its a one time flock.
Its probably a result of the switching to the new billing model.

How to get power usage for an app?

I have a program collecting wifi, acceleration, scan bluetooth and sometimes communicate with server. Does anybody know how to get power usage(voltage, current and power) of each component and the power usage of overall system?
There is no API for this in the Android SDK.
You can purchase a Qualcomm MDP device with the Trepn power profiler. This costs 1,000 USD, last I looked.
You can also try PowerTutor. I have not experimented with this yet but plan to in the coming months.
Or, you can examine the output from the Settings battery screen, if your app is showing up there.

Categories

Resources