• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






、Happiness↘.

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

2014年4月10日

查看手机电量
摘要: 1、创建BroadcastReceiver对象,重写onReceive()方法首先获取Action事件,当判断该事件为Intent.ACTION_BATTERY_CHANGED时,获取手机当前电量和总电量BroadcastReceiver br=new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub String s=intent.getAction(); if(Intent.A... 阅读全文
posted @ 2014-04-10 17:28 、Happiness↘. 阅读(196) 评论(0) 推荐(0)
 
提醒用户收到短信
摘要: 1、权限和创建广播 2、代码public class MyReceiver extends BroadcastReceiver{ @SuppressWarnings("deprecation") public void onReceive(Context context,Intent intent){ if(intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")){ StringBuilder sb=new StringBuilder(); Bundle bundle... 阅读全文
posted @ 2014-04-10 17:04 、Happiness↘. 阅读(118) 评论(0) 推荐(0)