Questions tagged [battery]

A battery is a portable electrical power source which is often used in mobile devices.

An electric battery is a device consisting of one or more electrochemical cells that convert stored chemical energy into electrical energy.

Each cell contains a positive terminal, or cathode, and a negative terminal, or anode. Electrolytes allow ions to move between the electrodes and terminals, which allows current to flow out of the battery to perform work.

871 questions
16
votes
2 answers

PubNub long polling vs sockets - mobile battery life

I recently began using PubNub in my iOS app, and am very happy with it. However, I have been looking at the other options available, such as Pusher and Realtime.co, which use Websockets. PubNub, on the other hand, uses long polling. I have done my…
user1032657
  • 2,451
  • 6
  • 28
  • 38
15
votes
6 answers

How to stop the phone from charging via USB programmatically

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…
Masi
  • 151
  • 1
  • 1
  • 3
14
votes
1 answer

Google Play Services Activity Recognition - Battery use?

Is the Google Play Services component always determining the user's current activity, or only when an app is connected to receive activity updates? The documentation isn't really clear about this, it just says that it has a minimal battery impact in…
Nick
  • 3,504
  • 2
  • 39
  • 78
13
votes
2 answers

ACTION_BATTERY_CHANGED firing like crazy

Okay, so I'm working on an AppWidget that checks the battery level and displays it on a TextView. My code looks like this: public class BattWidget extends AppWidgetProvider { private RemoteViews views = new RemoteViews("com.nickavv.cleanwidgets",…
Nick
  • 6,900
  • 5
  • 45
  • 66
13
votes
2 answers

How to measure energy usage in Xcode 13 / iOS15?

I'd like to confirm the battery usage of an app I am developing on iOS, specifically on Xcode 13 and iOS 15. (Note: This app previously showed no issues with battery usage on previous versions of iOS.) Previously, it seems that there were two ways…
Derek Lee
  • 3,452
  • 3
  • 30
  • 39
13
votes
3 answers

Android M startActivity battery optimization

I'm developing an app that should alert an user if is near a place. and of course have to do that also if the phone is in idle. With DOZE now I understood that I have to whitelist my app, and to do that I saw that I can start an intent with the…
Ast
  • 337
  • 1
  • 4
  • 17
13
votes
3 answers

How does Android determine if an app has "High Battery Use" under "Recent Location Requests"?

As of Kitkat (4.4) Android reports that my app is "High battery use". I use Network Location as well GPS. If I disable GPS, then it seems the app gets marked as "Low battery use". I'm wondering if there are any tips to using GPS while keeping the…
Martin Konecny
  • 57,827
  • 19
  • 139
  • 159
13
votes
3 answers

Android data storage - File vs SQLite

I am developing an application that periodically sends information to an external server. I make a local copy of the data being sent, for backup purposes. What is the best option to store the data in terms of saving battery life? Each data…
Guido
  • 46,642
  • 28
  • 120
  • 174
13
votes
3 answers

iPhone battery drain issue

I think my question will be useful for others. I have battery drain issue and want to find out where it is. I use xcode instruments: Enter profile then Energy Diagnostics, but I see nothing in energy usage section. How can I enable information in…
Paul T.
  • 4,938
  • 7
  • 45
  • 93
13
votes
3 answers

I can't receive broadcast on battery state change?

I am having the exact same problem as this post: Battery broadcast receiver doesn't work. But it seems no one has answered that question. Here is my BroadcastReceiver: public class BatteryLevelReceiver extends BroadcastReceiver{ @Override …
Zardaloop
  • 1,594
  • 5
  • 22
  • 43
12
votes
1 answer

How to measure battery voltage with internal adc ESP32

i'm doing wireless sensor node using (esp32, DHT11, soil moisture and nrf24l01) and i want to add an battery to supply those sensors, also need to measure battery voltage. For the battery, voltage always change to cant use as a Vcc reference, so i…
Quang Minh Lê
  • 169
  • 1
  • 2
  • 13
12
votes
1 answer

What is exactly "Adaptive battery", and what does it mean for app developers?

Background Google has announced on Google IO 2018 something that's called "Adaptive battery": https://youtu.be/ogfYd705cRs?t=3562 As a user, this sounds promising, but as a developer, this could be an issue in some cases. The problem They said it…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
12
votes
2 answers

How to test battery charging speed?

How can I detect battery charging speed in android device? I can detect battery status using below code. but not charging speed. IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_BATTERY_CHANGED); BatteryChangeReceiver…
Kishan Vaghela
  • 7,678
  • 5
  • 42
  • 67
12
votes
2 answers

Android - how do sensor readings affect battery life

i have added a feature in my app that uses the proximity and accelerometer sensors (the second is to detect shakes). This is implemented in an always running service (if the user selects it of course). But I fear for the battery usage that my ap…
Anonymous
  • 4,470
  • 3
  • 36
  • 67
12
votes
5 answers

How to get battery level with 1 % accuracy in ios

How to get battery level with 1 % accuracy . [UIDevice currentDevice].batteryLevel Will give battery level with accuracy of 5%. But i recently used Battery Doctor App on my iphone 4S running ios 5.1, which is giving battery level with 1%…
Ankit
  • 1,684
  • 14
  • 14
1
2
3
57 58