getSystemService()简介

    Android后台运行着很多service,它们随着系统启动时开始运行,支持系统的正常工作,应用程序可以通过Manager接口来访问system提供的数据.

    getSystemService()是Context类中的一个方法,它接受一个字符串参数来确定获取系统的哪个服务,并返回相应的服务对象(manager).


  • WINDOW_SERVICE ("window") 
    The top-level window manager in which you can place custom windows.The returned object is aWindowManager. 

  • LAYOUT_INFLATER_SERVICE ("layout_inflater")
    A LayoutInflater for inflating layout resources in thiscontext. 

  • ACTIVITY_SERVICE ("activity")
    A ActivityManager for interacting with the global activity state ofthe system. 

  • POWER_SERVICE ("power")
    A PowerManager for controlling powermanagement. 

  • ALARM_SERVICE ("alarm")
    A AlarmManager for receiving intents at the time of yourchoosing. 

  • NOTIFICATION_SERVICE ("notification")
    A NotificationManager for informing the user of backgroundevents. 

  • 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 vibratorhardware. 

  • CONNECTIVITY_SERVICE ("connection")
    A ConnectivityManager for handling management of networkconnections. 

  • WIFI_SERVICE ("wifi")
    A WifiManager for management of Wi-Ficonnectivity. 

  • INPUT_METHOD_SERVICE ("input_method")
    An InputMethodManager for management of inputmethods. 

  • UI_MODE_SERVICE ("uimode")
    An UiModeManager for controlling UI modes. 

  • DOWNLOAD_SERVICE ("download")
    A DownloadManager for requesting HTTP downloads
  • TELEPHONY_SERVICE
    A TelephonyManager  forprovideing access to information about the telephony services on the device
Note: System services obtained via this API may be closelyassociated with the Context in which they are obtained from. Ingeneral, do not share the service objects between various differentcontexts (Activities, Applications, Services, Providers,etc.)

   



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值