强制关闭其他应用,可以使用ActivityManager,首先需要获取(ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);然后可以调用其函数来进行关闭操作,目前来看有两种方法:1. void killBackgroundProces...
分类:
移动开发 时间:
2014-08-01 18:45:32
阅读次数:
292
//保持屏幕常亮
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, LOCK_TAG);
mWakeLo...
分类:
移动开发 时间:
2014-07-29 18:04:13
阅读次数:
236
Alarm和Timer不同的是Alarm是在应用程序之外操作的。即使应用程序关闭,它们也仍然能够用来激活应用程序事件或操作。
public void createAlarm(){
//获取一个Alarm Manager的引用
AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);...
分类:
移动开发 时间:
2014-07-29 15:09:38
阅读次数:
254
在发送一个Notification前,我们需要准备好一个NotificationManagerNotificationManager manager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE)...
分类:
其他好文 时间:
2014-07-28 21:25:24
阅读次数:
165
Android开发平台中,可通过TelephonyManager 获取本机号码。1 TelephonyManager phoneMgr=(TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);2 txtPhoneNumbe...
分类:
移动开发 时间:
2014-07-28 11:27:20
阅读次数:
331
AudioManager类提供了访问音量和振铃器mode控制。使用Context.getSystemService(Context.AUDIO_SERVICE)来得到这个类的一个实例。...
分类:
移动开发 时间:
2014-07-28 00:17:19
阅读次数:
592
Notification可以在手机的状态栏发出一则通知,它需要用NotificationManager来管理,实现Notification其实很简单。1.通过getsystemservice方法获得一个Notificationmanager对象NotificationManager notifica...
分类:
移动开发 时间:
2014-07-26 00:07:46
阅读次数:
325
InputMethodManager manager = (InputMethodManager) mContext .getSystemService(Context.INPUT_METHOD_SERVICE); if (((Activity) mContext).getW...
分类:
其他好文 时间:
2014-07-23 12:58:46
阅读次数:
178
//获取windowmanager 对象WindowManager wm = (WindowManager) getApplicationContext().getSystemService(WINDOW_SERVICE);//初始化桌面需显示的视图 View view = LayoutInfla....
分类:
移动开发 时间:
2014-07-22 00:17:35
阅读次数:
195
Html代码publicstaticbooleanisNetworkAvailable(Contextcontext){ConnectivityManagerconnectivity=(ConnectivityManager)context.getSystemService(Context.CONN...
分类:
移动开发 时间:
2014-07-21 23:31:03
阅读次数:
243