Android系統服務及權限設置
原文 :http://blog.sina.com.cn/s/blog_66edd39d01012i46.html
1 活動管理器
權限 <uses-permission android:name="android.permission.GET_TASKS"/>
代碼 ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
2 警報管理器
權限
代碼 AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
3 音頻管理器
權限
代碼 AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
4 剪貼板管理器
權限
代碼 ClipboardManager clipboardManager = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
5 連接管理器
權限 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
代碼 ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
6 輸入法管理器
權限
代碼 InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
7 鍵盤管理器
權限
代碼 KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
8 佈局解壓器管理器
權限
代碼 LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
9 位置管理器
權限
代碼 LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
10 通知管理器
權限
代碼 NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
11 電源管理器
權限 <uses-permission android:name="android.permission.DEVICE_POWER"/>
代碼 PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
12 搜索管理器
權限
代碼 SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
13 傳感器管理器
權限
代碼 SensorManager sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
14 電話管理器
權限 <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
代碼 TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
15 振動器
權限 <uses-permission android:name="android.permission.VIBRATE"/>
代碼 Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
16 牆紙
權限 <uses-permission android:name="android.permission.SET_WALLPAPER"/>
代碼 WallpaperService wallpaperService = (WallpaperService) getSystemService(Context.WALLPAPER_SERVICE);
17 Wi-Fi管理器
權限 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
代碼 WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
18 窗口管理器
權限
代碼 WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);