Questions tagged [batterymanager]

The BatteryManager class contains strings and constants used for values in the ACTION_BATTERY_CHANGED Intent.

The BatteryManager class contains strings and constants used for values in the ACTION_BATTERY_CHANGED Intent.

130 questions
2
votes
1 answer

Monitor Battery level on android phone

How can I programatically monitor the battery level on my android device ? I have read the examples posted on stackoverflow and the BatteryManager documentation where we need to register the Receiver for ACTION_BATTERY_CHANGED. My question is that I…
sim
  • 249
  • 7
  • 17
2
votes
2 answers

BatteryManager stats not working on Android

I am trying to get the batter level using a BroadCastReceiver: int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0); int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, 0); I have added the following permissions to the…
ssk
  • 9,045
  • 26
  • 96
  • 169
1
vote
0 answers

SMS_RECEIVED Broadcast receiver stops working after some time

I'm working on a utility application in which when an SMS is received with a specific message I need to send a reply message. To know the sms_received event i used a broadcast receiver. Below it the code of it in the manifest file.
1
vote
0 answers

How to get BATTERY_PROPERTY_CHARGE_COUNTER on api 21 Android

Why does getIntProperty return zero on the api device 21 val batteryManager = context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager val BatteryCapacity = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER)
Arman
  • 25
  • 7
1
vote
1 answer

Can I add the android battery level information to my location before sending data to firebase?

I am creating an android gps tracking application and so far have my location uploaded to firebase using the Location Class: DatabaseReference ref = FirebaseDatabase.getInstance().getReference(path); Location location =…
dneyed
  • 11
  • 2
1
vote
1 answer

Trigger BroadcastReceiver when low battery in Android

I'm trying to trigger the broadcast receiver whenever the battery is low irrespective of whether the app is in the foreground/killed. The Broadcast's onReceive() is never been called. I've followed the Official doc & I've gone through almost all…
1
vote
1 answer

BatteryManager's BATTERY_PROPERTY_CURRENT_NOW returning 0 or incorrect current value

I am using using BattteryManager on android to get the discharging/charging current on my app. But I've notice that although it works on many devices, but in some devices like Samsung (android 10), Realme (android 10) and Huawei (android 9) the code…
Sourav
  • 312
  • 1
  • 8
1
vote
2 answers

Configure AOSP for a batteryless device?

I am building Android AOSP 8.1 (Oreo) for a phone-like device, which is permanently mounted (e.g. industrial deployment) and has no battery. However, when I power it up, it shows a charging indicator and a power reading of 6%. What do I have to…
ltx
  • 45
  • 9
1
vote
1 answer

How to detect if charger attached to phone is not charging phone?

I want to know if the charger attached to phone is charging the phone or not. Use case is, if you plug in charger but forget to switch on the charging, you should get a notification.
Rana
  • 19
  • 6
1
vote
1 answer

Unable to create an instance of batteryManager

Unable to create an instance of batteryManager from android.os package if I try to create the instance like below Batterymanager bm = new BatteryManager(); What i am excepting is too get the properties via battery manager object but i am getting…
1
vote
0 answers

How to get battery current (mA) from android device

I have this problem: I have created an application for monitoring the phone battery values. On my samsung, I can get battery current in mA with BatteryManager and property BATTERY_PROPERTY_CURRENT_NOW, but on other android devices with same OS…
1
vote
1 answer

Where can I find a list of values for EXTRA_ONLINE?

I'm trying to build a profile for the Tasker app that responds to the BATTERY_CHANGED broadcast intent and I saw one of the Extras called Online that appears to correspond with the specific charger type or condition, but I can't seem to find a…
Ceetch
  • 177
  • 4
  • 17
1
vote
1 answer

How to stop android notification from repeating itself

I'm trying to push a notification whenever battery status is below 5% but I want it once only. With below code it's keep on repeating unless battery level gets out of condition. else if((level<=5)&(level>0)){ …
Hawk
  • 15
  • 4
1
vote
1 answer

How can I know if the battery stop charging because of overheat, while the user run my application - Android?

I mean the charger is plugged in but it is not charging. Is there any indication from the system about it? I see it in "Waze" application when I get a message that the buttery stop charging because it is overheating. my application is also a heavy…
batsheva
  • 2,175
  • 1
  • 20
  • 32
1
vote
1 answer

WearOS how to check is battery is plugged

I'm developing a watch face that collects data. In order to save battery, I'm storing data into an SQLite database. I want to detect when the smart watch is plugged in in order to send the database from watch to phone. I have succesfully implemented…
majTheHero
  • 123
  • 1
  • 13
1 2 3
8 9