zoukankan      html  css  js  c++  java
  • 【Android】16.5 Android内置的系统服务

    分类:C#、Android、VS2015;

    创建日期:2016-03-01

    一、简介

    实际上,在Android.Content.Context类中,Android已经提供了多种类型的系统服务,这些服务都以静态的形式通过Android.Content.ContextWrapper类提供的GetSystemService()方法让开发人员调用。

    在Activity及其子类中,可直接调用GetSystemService方法。例如:

    public class MainActivity : Activity
    {
        LocationManager locMgr;
        ……
        protected override void OnResume()
        {
            locMgr = GetSystemService(Context.LocationService) as LocationManager;
            ……..
        }
        ……
    }

    二、系统服务类型

    Context类提供的系统服务很多,下面仅列出一些常用的服务。这些服务都是以常量字符串的形式定义在Context类中的,键入Context和“.”即可可看到这些服务。

    AudioService:音频服务

    BatteryService:电池服务

    BluetoothService:蓝牙服务

    CameraService:相机服务

    ConnectivityService:网络连接管理服务

    LocationService:位置服务,控制位置等设备的更新

    WifiService:Wi-Fi连接管理

    VibratorService:设备震动服务,用于访问支持振动的硬件

    AlarmService:在指定的时间接受Intent报警

    其他系统服务

    Context提供的其他系统服务还有:

    AccessibilityService
    AccountService
    ActivityService
    AppOpsService
    AppwidgetService
    CaptioningService
    CarrierConfigService
    ClipboardService
    ConsumerIrService
    DevicePolicyService
    DisplayService
    DownloadService
    DropboxService
    FingerprintService
    InputMethodService:输入法管理
    InputService
    JobSchedulerService
    KeyguardService
    LauncherAppsService
    LayoutInflaterService
    MediaProjectionService
    MediaRouterService
    MediaSessionService
    MidiService
    NetworkStatsService
    NfcService
    NotificationService:后台事件通知
    NsdService
    PowerService:电源管理
    PrintService
    RestrictionsService
    SearchService
    SensorService
    StorageService
    TelecomService
    TelephonyService
    TelephonySubscriptionService
    TextServicesManagerService
    TvInputService
    UiModeService
    UsageStatsService
    UsbService
    UserService
    WallpaperService
    WifiP2pService
    WindowService--最顶层的窗口服务
  • 相关阅读:
    I NEED A OFFER!
    水题 Codeforces Round #303 (Div. 2) A. Toy Cars
    模拟 HDOJ 5099 Comparison of Android versions
    模拟 HDOJ 5095 Linearization of the kernel functions in SVM
    贪心 HDOJ 5090 Game with Pearls
    Kruskal HDOJ 1863 畅通工程
    Kruskal HDOJ 1233 还是畅通工程
    并查集 HDOJ 1232 畅通工程
    DFS/并查集 Codeforces Round #286 (Div. 2) B
    水题 Codeforces Round #286 (Div. 2) A Mr. Kitayuta's Gift
  • 原文地址:https://www.cnblogs.com/rainmj/p/5229571.html
Copyright © 2011-2022 走看看