How to get power usage for an app? - java

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.

Related

How to get total CPU time for android app

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?

Android - evaluate device performance in app/game

I just started using libgdx to develop android games and i'm currently developing a game which would adjust the quantity and/or quality of the enemies/animations/drops/etc shown in the screen, depending on how many the device supports.
Some devices may be faster and support a greater amount of enemies, but others may begin to lag and i wanted to prevent that by disabling some options of the game, without any user interaction.
But i'm facing a problem: i don't know how to evaluate the device RAM, GPU, etc. and even if i did, i don't know how many enemies i can have given the device specifications.
Is there any way to estimate how many enemies/animations/drops/etc i can have for a device?

How to run a wifi management program in android emulator?

I'm working on a basic android wifi management program, but I don't have a real device. So I have to run it on android emulator?
I have searched, and understand that I can't work real wifi network. But it's not important for now, I just want to test my program on emulator.
I want to ask that if I can add virtual wifi networks to my emulator?
Thanks.
I think this is about as close as you can get:
http://kmansoft.com/2010/07/27/debugging-wifi-in-the-emulator/
Strong suggestion: buy a small, cheap, no-contract handset. T-Mobile and Virgin both offer them, you can buy them at Target, Best Buy, Radio Shack, etc (in the U.S., at least)

Find users near your position

I'm looking for a way to find users in a certain radius of your position.
The reason I need this is because I want to know how many people there are in an area.
A possible way I found is to activate the bluetooth and find active devices around.
I want to know if there are other solutions, API, possibilities to do this.
There was talk of peer to peer wifi connections, but not sure the status. Would give you some more distance than bluetooth. There is also a library
Can Android do peer-to-peer ad-hoc networking?
there is also a library from qualcomm
https://developer.qualcomm.com/develop/mobile-technologies/peer-peer-alljoyn/faq
Your best bet would probably be with searching for bluetooth devices.
Most phones have a class 2 bluetooth radio which is generally rated at a range of 10 m, but it can very greatly on the environment (for example, you would notice significant packet loss transmitting through even a small amount of water, such as in a person.) On the other side of the coin, the radio could detect devices up to 100 m away if there were nothing but air between the two devices.
The main problem with this is that you would have to require bluetooth to be active, which a lot of users might not have by default.

Real-time FFT plotting

I have a bit of am odd question that I am hoping someone here can help me with.
BACKGROUND: I am trying to design a system that will take in continuous-time data from a VLF antenna/preamp system which will take that data, do an FFT analysis of on it (magnitude versus time) and plot the resulting FFT data as a real-time spectrogram. The project is what is known as a "hum sniffer" but specifically to see signal interference in the 15 - 35 kHz range. I have purchased a couple of "teach yourself java" books and am in the process of reading them. I am an engineering student with limited experience with programming in Ansi-C and Matlab.
QUESTION: There are several applications on the Android market that will perform a similar function using the microphone as the input source and I have purchased all of them just to see how they operate. I have also purchased an Arduino Uno with USB Host shield from Sparkfun as well as a IOIO board from Sparkfun. I am really REALLY hoping that I can use a combination of those boards I have purchased in conjunction with the aforementioned antenna/preamp system to plot those real-time spectrograms in an Android program I have yet to create.
I am not looking for anyone to hold my hand through this process but if anyone has any experience with anything similar I would appreciate any insight. My major concern at this point is whether I need to design the external system to do the A/D conversion before feeding that data into the phone or if I might be able to send the CT signal data into Android directly and have the phone do both the A/D conversion and the FFT plots. Oh, and whether or not I can use the USB port to send data into the phone.
I am using my Nexus S 4G for all testing/applications.
Thanks in advance for any input.
Have you tried connecting your audio on the phone's headset microphone connection and using a sound recording app? Then you should get a file that you can read into Matlab and play around with to get an idea of the capabilities of the audio input on the phone.
If the audio input good enough then writing an app to do real-time FFT and plotting shouldn't be too tricky. That way you avoid dealing with Arduino and the Android USB accessory support.
IOIO hardware is capable of 500ksps. This is currently being limited in firmware to 1ksps per channel in order to bound the USB bandwidth being used. However, it is super easy to change (a single number, and a firmware rebuild) in case you know what you're doing and won't overflow the USB channel.
A single sample on a single channel will be a 3B message. At 40KHz, this would be 120KB/s, which is within the effective bandwidth that has been reached over ADB (the maximum is about 300KB/s).
If you need help rebuilding the firmware, the ioio-users list is your friend.

Categories

Resources