Android_服务于广播(2)

1.获取手机SIM卡信息
      //获得服务
    tm.(TelephoneyManager)getSystemService(Context.TELEPHONY_SERVICE);
    //获得设备的编号
      String deviceId=tm.getDeviceId();
    //获得SIM的国别
      String Country=tm.getSimCountryIso();
    //获得SIM卡的序列号
    String SIMSerial=tm.getSerialNumber();
    //获得SIM卡的状态
    String SIMState=simState[tm.getSimState()];
    //获得网络运行商的名称
    String networkOperatorName=tm.getNetworkOperatorName();
    //获得手机的制式
      String phoneType=phoneTypes[tm.getPhoneType()];

2.获得系统软键盘
    //获得对象
    imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    //第一次调用显示,再次调用则隐藏,如何反复
    imm.toggleSoftInput(0,InputMethodManager.HIDE_NOT_ALWAYS);

3.开启行车模式,夜光模式
    //获得对象
    uiModeManager=(UiModeManager)getSystemService(Context.UI_MODE_SERVICE);
    //行车模式
    uiModeManager.enableCarMode(UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME);
    //夜间模式
  uiModeManager.setNightMode(UiModeManager.MODE_NIGHT_YES);

4.音量控制器
    audioManager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
    //得到当前的通话声音
    int currentCall=audioManager.getStreamVolume(AudioManager.STREAM_VOICE_CALL);
    //得到当前的系统音量
    int currentSystem=audioManager.getStreamVolume(AudioManager.STREAM_MUSIC):
    //得到当前的提示音声音音量
    int currentTip=audioManager.getStreamVolum(AudioManager.STREAM_ALARM);
    //增加系统音量、参数1.声音类型,参数2.调整音量的方向,参数3.可选的标志位
    audioManager.adjustStramVolum(AudioManager.STREAM_SYSTEM,AudioManager.ADJUST_RAISE,AudioManager.Fx_FOCUS_NAVIGATION_UP);
   
5.手机电池补充
      //得到电池的电压
    int voltage=intent.getIntExtra("voltage",0);
    //得到电池的温度
      int temperature=intent.getIntExtra("temperature",0);
    //得到电池的类型
      String texhnology=intent.getStringExtra("technology");

6.桌面空间方式
    //创建
    intent shortcut=new Intent(CREATE_SHORTCUT_ACTION);
    //得到包名
    Intent shortcutIntent =cx.getPackageManager().getLaunchIntentForPackag e(cx.getPackageName());
    //设置快捷方式的单击指向
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shotcutIntent);
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值