问题标签 [batterylevel]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
174 浏览

objective-c - 如何在 Mac OS 中为蓝牙设备的功率电平状态变化设置事件?

我有一个简单的问题。

我们可以通过编程方式(使用 Cocoa 框架)获取与 mac os 配对的设备的电池电量吗?是否存在提供此数据的任何事件?

我可以使用 NSTask 和 ioreg 命令获取此信息,但我认为这不是最好的方法。

谢谢你的提前,

0 投票
1 回答
242 浏览

ios - 在后台运行 iOS 低功耗蓝牙应用时的电池排放量有多大

我需要知道在后台运行正在扫描附近 iBeacons 的 iOS 应用程序时电池排放量有多大。

电池贵吗?

0 投票
1 回答
30632 浏览

android - 连接BLE设备后如何获取电量?

我正在开发一个应用程序,我必须在其中连接到 Android 4.3 上的蓝牙设备。

我想通过使用Battery_ServiceBattery_Level来获取电池电量。

但值mBluetoothGatt.readCharacteristic(batteryLevel);不是电池电量值

如何读取电池?

0 投票
0 回答
456 浏览

android - 监测电池充电状态变化

这是我的代码,它成功显示了当前充电状态、电压和电池电量。但是当充电器拔出或插入时(即当状态发生变化时,我的应用程序将强制关闭)。任何机构请帮助,因为我是 android 新手。谢谢。

0 投票
1 回答
222 浏览

android - 获取 Android 设备电池的当前负载

我需要 Android 设备电池上的当前负载。我知道如何获取当前电池输出电压和当前电池电量,但无法弄清楚设备当前对电池施加了多少负载。例如,我想在启动谷歌地图之前查看电池的负载,然后想在启动谷歌地图后查看电池的负载。

有没有办法我可以做到这一点?任何帮助都会很棒!

0 投票
0 回答
207 浏览

android - 确定每个 CPU 周期消耗多少电池寿命

对于 Android 应用程序,我需要知道每个 CPU 周期消耗了多少电池寿命。我想知道该功能使用了多少能量,有没有办法确定?

0 投票
1 回答
552 浏览

iphone - 有什么方法可以在 ios7 中获得正确的电池电量?

我在一个名为“batteryLevel”的标签中显示了电池电量。用于此的代码如下,

但是我得到了 95%、90% 等的电池电量。我必须准确地显示电池电量,就像在当前设备中显示的那样。在 ios7 和以前的 ios 版本中有没有正确的方法来找出电池电量?请给我一个解决这个问题的方法。

0 投票
2 回答
3428 浏览

python - Python script to charge and discharge laptop battery

A friend of mine recently inherited an old laptop and has freshly installed windows 7, and wants to increase the battery life. Initially the battery lasted around 20mins, but by manually allowing the battery to fully discharge before recharging, a few times, he has managed to increase the lifetime to around an hour. We thought it would be fun to see just how much we could increase the performance of the battery! and I thought to write a script to cycle the battery overnight - and this may be useful to occasionally run on any computer to maintain battery health? I can get the battery status, but cannot see how to instruct the laptop to ignore the presence of the AC powerline and use the battery. I have a feeling the answer is out there: https://pypi.python.org/pypi/LaptopControlPanel but I am completely at my limit with regards to my understanding! Any help would be great.

The first if statement is where I would like to force battery use... The above code is mostly stolen from In Python, how can I detect whether the computer is on battery power?.

Thank-you.

0 投票
2 回答
2599 浏览

c#-4.0 - 只显示一次消息框

我正在使用以下代码在达到充电水平时显示一个消息框

此代码正在运行。但它不止一次显示消息框。我只想展示一次。

谢谢

0 投票
2 回答
2007 浏览

python - 在 python 中使用 wmi 获取电池状态?

我知道如何使用 wmi,我以前使用过它,但是,我似乎需要调用的 wmi 类是 GetSystemPowerStatus。但我在查找和记录它时遇到了麻烦。为了能够访问它,我需要知道命名空间以及类内数据的格式。有人可以帮助我吗?还有一些示例代码会很好。