码迷,mamicode.com
首页 >  
搜索关键字:getsystemservice    ( 396个结果
Android开发之使用Notification.Builder
大体使用步骤: 1.获取状态通知栏管理 NotificationManager 是一个系统Service,所以必须通过 getSystemService(NOTIFICATION_SERVICE)方法来获取。 notificationManager = (NotificationManager) this .getSystemService(NOTIFICATION_SERVICE); 2.实例化通知栏构造器NotificationCompat.Builder 3.设置Notifica...
分类:移动开发   时间:2015-05-17 07:06:20    阅读次数:220
Notification新旧用法
//api 11 版本之前:protected void showNotification() { NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATI...
分类:其他好文   时间:2015-05-14 11:33:30    阅读次数:119
android判断手机SIM状态
public String readSIMCard() { TelephonyManager tm = (TelephonyManager)this.getSystemService(TELEPHONY_SERVICE);//取得相关系统服务 StringBuffer sb = new StringBuffer(); switch(tm.getSimState()){ //getSimSta...
分类:移动开发   时间:2015-05-07 22:19:32    阅读次数:192
getSystemservice()原理
1. 说明 android的后台运行在很多service,它们在系统启动时被SystemServer开启,支持系统的正常工作,比如MountService监听是否有SD卡安装及移除,ClipboardService提供剪切板功能,PackageManagerService提供软件包的安装移除及查看....
分类:其他好文   时间:2015-05-06 22:46:56    阅读次数:206
使用android传感器自己编写温度计,湿度计 支持android5.0
编写温湿度计的原理很简单,就是获取温度,湿度传感器的数据,和其它的传感器的使用方法是一样的(前提是手机要有温度,湿度传感器)   首先是获取传感器管理器:   (SensorManager) getSystemService(Context.SENSOR_SERVICE);  可以通过下面这段代码查看手机上有哪些传感器: List deviceSensors = mSensorManag...
分类:移动开发   时间:2015-05-06 15:15:20    阅读次数:288
隐藏输入软键盘
case R.id.back:// 返回 ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(AccountActivity.this .getCurrentF...
分类:其他好文   时间:2015-05-05 10:29:46    阅读次数:104
判断当前应用是否在后台运行
/**判断程序是否在后台运行*/ public static boolean isRunBackground(Context context) { ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); List appProcesses =...
分类:其他好文   时间:2015-05-04 15:39:31    阅读次数:137
Android获取各种设备的状态
WIFI 获取WIFI状态 WifiManager wifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE); if(wifiManager != null){ int wifiStat...
分类:移动开发   时间:2015-04-30 12:10:18    阅读次数:148
android修改系统时区
动态注册广播接收器必须有实例存在设置系统时区: AlarmManager mAlarmManager =(AlarmManager)getSystemService(Context.ALARM_SERVICE);mAlarmManager.setTimeZone("GMT+08:00");设置时区需...
分类:移动开发   时间:2015-04-25 16:24:47    阅读次数:230
Android 判断app是否在前台运行
1 private boolean isForeground(Context context) { 2 ActivityManager am = (ActivityManager) context 3 .getSystemService(Contex...
分类:移动开发   时间:2015-04-24 18:45:30    阅读次数:154
396条   上一页 1 ... 18 19 20 21 22 ... 40 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!