getSystemService()简介

来源:互联网 发布:mac上的ps软件 编辑:程序博客网 时间:2024/06/07 09:49

    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 0