Android 低电量指示

发布于 2024-12-11 03:33:44 字数 144 浏览 5 评论 0原文

Linux 驱动程序应如何向用户空间指示低电量指示? 我在 power_supply.h 中没有找到对此的任何支持。 android 服务是否应该通过读取电池容量来处理这个问题?

Highyl 感谢您为回答此问题所做的努力。

谢谢 加内什。

How should the linux driver indicate low battery indication to the user space ?
I do not find any support for this in power_supply.h. Is the android service supposed to handle this by reading the battery capacity ?

Highyl appreciate efforts to answer this query.

Thanks
Ganesh.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

涙—继续流 2024-12-18 03:33:44

添加此代码

private BroadcastReceiver mBatInfoReceiver = new BroadcastReceiver(){
      @Override
      public void onReceive(Context arg0, Intent intent) {          
          int level = intent.getIntExtra("level", 0);
          // level...... it will show the battery information
          // you can use this variable to show the battery information.               
      }
};

this.registerReceiver(this.mBatInfoReceiver,new IntentFilter(Intent.ACTION_BATTERY_CHANGED));

add this code

private BroadcastReceiver mBatInfoReceiver = new BroadcastReceiver(){
      @Override
      public void onReceive(Context arg0, Intent intent) {          
          int level = intent.getIntExtra("level", 0);
          // level...... it will show the battery information
          // you can use this variable to show the battery information.               
      }
};

and

this.registerReceiver(this.mBatInfoReceiver,new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文