battery

ContentObserver vs. BroadCastReceiver : Battery Usage, Ram, CPU?

a 夏天 提交于 2019-12-05 11:57:48
Since there is such a needed concern for an application's battery usage, ram and cpu usage, what is the expense of multiple contentobservers vs. multiple broadcastreceivers? Example 1: A service running with START_STICKY using 5 contentobservers registered/unregistered properly. Example 2: A service being fired from 5 broadcastreceivers set in the manifest. Example 3: A service running with START_STICKY using 5 registered broadcastreceivers. What is the true difference in battery usage/ram/cpu between an observer and a receiver? Can any pros chime in on this? I'm assuming 1 instance wouldn't

How can I find out how much battery my Android app consumes on user's devices?

我只是一个虾纸丫 提交于 2019-12-05 10:48:45
问题 I am writing an app to evaluate the feasibility of a Bluetooth P2P network on Android. I noticed that on a Galaxy Nexus, it uses very little battery, while on a Nexus S, it drains the battery very quickly. This is directly caused by high CPU load due to Bluetooth. Now, I would like to collect information about how much battery drain my app causes on the devices it is installed upon. Simply logging time vs. battery level is useless since I don't know when the device is in use, and even if I

How does persistent tcp/ip connections preserve battery and lower bandwidth usage?

佐手、 提交于 2019-12-05 03:17:53
问题 In push notification mechanisms, like Apple's Push Notification Service, they use persistent IP connections. My question is, how does employing persistent connections save battery and bandwidth of a device? I am under the impression that since the connection is persistent, then the device always uses the WiFi or 3G/LTE radio. I know that through persistent connections, you will not waste bandwidth by not asking the server for changes when there is none, and instead the server will "push" to

How to get percentage of battery usage by each app in android programatically

让人想犯罪 __ 提交于 2019-12-05 02:38:41
问题 I am making a demo for battery usage percentage by all apps.I am able to get the total available battery percentage but want to get battery usage by percentage by each app separate.So Is there any way to do so as lot many apps are available in market.Please help or suggest to save newbie. 回答1: Only battery usage screen in Settings, where you can see battery usage of each application. There is no API or command-line way to get this information. See similar question discussion in stackoverflow

Linux c++: apis vs /proc files?

时间秒杀一切 提交于 2019-12-04 18:15:02
问题 Im working on an app to collect and send various bits of system info (partition space/free, laptop battery info, etc). Im not having much success getting this information in the form of direct c++ api.. though its all available via files in /proc (or similar). So - I'm wondering whether reading/parsing these files in my c++ app is the appropriate way to get this info or should I keep trying to discover APIs? ( NOTE: I am working with statvfs ). So far it looks like it's easier to gather this

Battery circle like Battery Widget Reborn

六眼飞鱼酱① 提交于 2019-12-04 17:44:28
I am trying to make draw a circle based on the battery percentage. I have the following code: Bitmap.Config conf = Bitmap.Config.ARGB_8888; // see other conf types Bitmap bmp = Bitmap.createBitmap(200, 200, conf); Paint mPaint = new Paint(); mPaint.setDither(true); mPaint.setColor(Color.BLUE); mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeJoin(Paint.Join.ROUND); mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setStrokeWidth(5); circle = new Path(); circle.addCircle(100, 100, level, Direction.CW); Canvas canvas = new Canvas(bmp); canvas.drawPath(circle, mPaint); I am trying to get similar

Android : Turn on a device programmatically

*爱你&永不变心* 提交于 2019-12-04 11:26:05
问题 I have a smartphone connected to a solar charger. By day, it is powered correctly. But during the night, sometimes it turns itself off due to the lack of energy. My question is : It is possible to turn it back on (programmatically), when the battery charge exceeds a certain percentage? I'm looking for a clean and legal way. I'm not interested in flaws or exploits. I found nothing in the official documentation. Thank you. 回答1: The mechanism for doing this relies on replacing the battery

In Android, is there a way to get the battery current? [duplicate]

拈花ヽ惹草 提交于 2019-12-04 11:00:41
This question already has answers here : Getting the battery current values for the Android Phone (8 answers) Closed 6 years ago . The BatteryManager class doesn't have the metric for current: http://developer.android.com/reference/android/os/BatteryManager.html And then I have found this post: Getting the battery current values for the Android Phone It seems that the author also found it was not possible to get such value from the Linux entry. I also downloaded the widget called CurrentWidget into my Nexus 7. For the current value, it shows "no data". So probably a current sensor is required

How to stop the phone from charging via USB programmatically

回眸只為那壹抹淺笑 提交于 2019-12-04 10:23:16
问题 I've tried to do as much research as possible but can't find an answer to this fairly simple question (want to figure this out before I'm going to set up the SDK and everything).I'm thinking about developing my first app and am wondering whether the BATTERY_STATUS_CHARGING from the BatteryManager contains only a get function or also a set function. I wan't to make an app in which I can manually stop the phone from charging without unplugging it from the charger (via USB) and so am wondering

What are the most battery-consuming things you can do in an iPhone-app?

喜你入骨 提交于 2019-12-04 09:40:11
问题 I am making an app that quickly drains the users battery. For this, I am planning on using the sound-framework for vibrating, location services, download large but empty files from the internet, use the flashlight on the back of the phone, and so on. I know these can effectively drain the battery, but I would like to know if there are more methods that are more or equally power/processor-consuming or that could work for this in any way? Examples on how to achieve 100% CPU usage is also very