public abstract Object getSystemService (String name)
Since: API Level 1
Return the handle to a system-level service by name. The class of the returned object varies by the requested name. Currently available names are:
WINDOW_SERVICE
("window")- The top-level window manager in which you can place custom windows. The returned object is a
WindowManager
. LAYOUT_INFLATER_SERVICE
("layout_inflater")- A
LayoutInflater
for inflating layout resources in this context. ACTIVITY_SERVICE
("activity")- A
ActivityManager
for interacting with the global activity state of the system. POWER_SERVICE
("power")- A
PowerManager
for controlling power management. ALARM_SERVICE
("alarm")- A
AlarmManager
for receiving intents at the time of your choosing. NOTIFICATION_SERVICE
("notification")- A
NotificationManager
for informing the user of background events. KEYGUARD_SERVICE
("keyguard")- A
KeyguardManager
for controlling keyguard. LOCATION_SERVICE
("location")- A
LocationManager
for controlling location (e.g., GPS) updates. SEARCH_SERVICE
("search")- A
SearchManager
for handling search. VIBRATOR_SERVICE
("vibrator")- A
Vibrator
for interacting with the vibrator hardware. CONNECTIVITY_SERVICE
("connection")- A
ConnectivityManager
for handling management of network connections. WIFI_SERVICE
("wifi")- A
WifiManager
for management of Wi-Fi connectivity. INPUT_METHOD_SERVICE
("input_method")- An
InputMethodManager
for management of input methods. UI_MODE_SERVICE
("uimode")- An
UiModeManager
for controlling UI modes. DOWNLOAD_SERVICE
("download")- A
DownloadManager
for requesting HTTP downloads
Note: System services obtained via this API may be closely associated with the Context in which they are obtained from. In general, do not share the service objects between various different contexts (Activities, Applications, Services, Providers, etc.)
Parameters
name | The name of the desired service. |
---|
Returns
- The service or null if the name does not exist.
See Also
WINDOW_SERVICE
WindowManager
LAYOUT_INFLATER_SERVICE
LayoutInflater
ACTIVITY_SERVICE
ActivityManager
POWER_SERVICE
PowerManager
ALARM_SERVICE
AlarmManager
NOTIFICATION_SERVICE
NotificationManager
KEYGUARD_SERVICE
KeyguardManager
LOCATION_SERVICE
LocationManager
SEARCH_SERVICE
SearchManager
SENSOR_SERVICE
SensorManager
STORAGE_SERVICE
StorageManager
VIBRATOR_SERVICE
Vibrator
CONNECTIVITY_SERVICE
ConnectivityManager
WIFI_SERVICE
WifiManager
AUDIO_SERVICE
AudioManager
TELEPHONY_SERVICE
TelephonyManager
INPUT_METHOD_SERVICE
InputMethodManager
UI_MODE_SERVICE
UiModeManager
DOWNLOAD_SERVICE
DownloadManager