Android Guides | Samples

Android.Content.Context.GetSystemService Method

Return the handle to a system-level service by name.


[Android.Runtime.Register("getSystemService", "(Ljava/lang/String;)Ljava/lang/Object;", "GetGetSystemService_Ljava_lang_String_Handler")]
public abstract Object GetSystemService (String name)

See Also


The name of the desired service.


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:

Context.WindowService ("window")
The top-level window manager in which you can place custom windows. The returned object is a IWindowManager.
Context.LayoutInflaterService ("layout_inflater")
A LayoutInflater for inflating layout resources in this context.
Context.ActivityService ("activity")
A ActivityManager for interacting with the global activity state of the system.
Context.PowerService ("power")
A PowerManager for controlling power management.
Context.AlarmService ("alarm")
A AlarmManager for receiving intents at the time of your choosing.
Context.NotificationService ("notification")
A NotificationManager for informing the user of background events.
Context.KeyguardService ("keyguard")
A KeyguardManager for controlling keyguard.
Context.LocationService ("location")
A LocationManager for controlling location (e.g., GPS) updates.
Context.SearchService ("search")
A SearchManager for handling search.
Context.VibratorService ("vibrator")
A Vibrator for interacting with the vibrator hardware.
Context.ConnectivityService ("connection")
A ConnectivityManager for handling management of network connections.
Context.WifiService ("wifi")
A WifiManager for management of Wi-Fi connectivity.
Context.WifiP2pService ("wifip2p")
A WifiP2pManager for management of Wi-Fi Direct connectivity.
Context.InputMethodService ("input_method")
An InputMethodManager for management of input methods.
Context.UiModeService ("uimode")
An UiModeManager for controlling UI modes.
Context.DownloadService ("download")
A DownloadManager for requesting HTTP downloads
Context.BatteryService ("batterymanager")
A BatteryManager for managing battery state
Context.JobSchedulerService ("taskmanager")
A JobScheduler for managing scheduled tasks
Context.NetworkStatsService ("netstats")
A NetworkStatsManager for querying network usage statistics.

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.)

[Android Documentation]


Namespace: Android.Content
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions:
Since: Added in API level 1