Android 系统服务getSystemService

本文介绍了Android系统中通过publicObject getSystemService(String name)方法获取各种系统服务的API。这些服务包括窗口管理、布局填充、活动管理等关键组件,为开发者提供了丰富的功能以实现应用程序的各种需求。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

public 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

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值