大体使用步骤:
1.获取状态通知栏管理
NotificationManager 是一个系统Service,所以必须通过 getSystemService(NOTIFICATION_SERVICE)方法来获取。
notificationManager = (NotificationManager) this
.getSystemService(NOTIFICATION_SERVICE);
2.实例化通知栏构造器NotificationCompat.Builder
3.设置Notifica...
分类:
移动开发 时间:
2015-05-17 07:06:20
阅读次数:
220
//api 11 版本之前:protected void showNotification() { NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATI...
分类:
其他好文 时间:
2015-05-14 11:33:30
阅读次数:
119
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
1. 说明 android的后台运行在很多service,它们在系统启动时被SystemServer开启,支持系统的正常工作,比如MountService监听是否有SD卡安装及移除,ClipboardService提供剪切板功能,PackageManagerService提供软件包的安装移除及查看....
分类:
其他好文 时间:
2015-05-06 22:46:56
阅读次数:
206
编写温湿度计的原理很简单,就是获取温度,湿度传感器的数据,和其它的传感器的使用方法是一样的(前提是手机要有温度,湿度传感器)
首先是获取传感器管理器:
(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
WIFI 获取WIFI状态 WifiManager wifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE); if(wifiManager != null){ int wifiStat...
分类:
移动开发 时间:
2015-04-30 12:10:18
阅读次数:
148
动态注册广播接收器必须有实例存在设置系统时区: AlarmManager mAlarmManager =(AlarmManager)getSystemService(Context.ALARM_SERVICE);mAlarmManager.setTimeZone("GMT+08:00");设置时区需...
分类:
移动开发 时间:
2015-04-25 16:24:47
阅读次数:
230
1 private boolean isForeground(Context context) { 2 ActivityManager am = (ActivityManager) context 3 .getSystemService(Contex...
分类:
移动开发 时间:
2015-04-24 18:45:30
阅读次数:
154