Android常用系统服务

通过Activity类的getSystemService方法可以获得指定的系统服务。

getSystemService方法只有一个String类型的参数,表示系统服务的ID,这个ID在整个Android系统中是唯一的。

Android SDK在android.content.Context类中定义了这些ID。如下:


Constants


AccessibilityManager


ACCESSIBILITY_SERVICE


通过已注册的事件监听器将UI事件反馈给用户。

主要是一些View获得点击、焦点、文字改变等事件的分发管理,对整个系统的调试、问题定位等,也需要最这个服务仔细过目一下。


AccountManager


ACCOUNT_SERVICE


在你选择的时间接收 Intents


ActivityManager


ACTIVITY_SERVICE


Activity服务


AlarmManager


ALARM_SERVICE


闹钟服务


AppOpsManager


APP_OPS_SERVICE


Use with getSystemService(String) to retrieve a AppOpsManager for tracking application operations on the device.

在设备操作跟踪应用


AudioManager


AUDIO_SERVICE


音频服务。管理音量,响铃模式和音频路由


BluetoothAdapter


BLUETOOTH_SERVICE


蓝牙服务


CaptioningManager


CAPTIONING_SERVICE


Use with getSystemService(String) to retrieve a CaptioningManager for obtaining captioning properties and listening for changes in captioning preferences.


ClipboardManager


CLIPBOARD_SERVICE


剪切板服务


ConnectivityManager


CONNECTIVITY_SERVICE


网络连接服务。可供其他应用查询,当网络状态变化时,也可广播改变。


ConsumerIrManager


CONSUMER_IR_SERVICE


红外信号服务。操作发射红外信号的装置


DevicePolicyManager


DEVICE_POLICY_SERVICE


设备监听服务


DisplayManager


DISPLAY_SERVICE


Use with getSystemService(String) to retrieve a DisplayManager for interacting with display devices.

获取 DisplayManager 以和显示设备交互。


DownloadManager


DOWNLOAD_SERVICE


下载服务。HTTP下载请求


DropBoxManager


DROPBOX_SERVICE


获取 DropBoxManager 实例以记录诊断日志。


InputMethodManager


INPUT_METHOD_SERVICE


输入法的管理服务程序,包括何时使能输入法,切换输入法等等。


InputManager


INPUT_SERVICE


获取 InputManager 以和输入设备交互。


NotificationManager


KEYGUARD_SERVICE


获取 NotificationManager 以控制键盘锁


LayoutInflater


LAYOUT_INFLATER_SERVICE


Use with getSystemService(String) to retrieve a LayoutInflater for inflating layout resources in this context.


LocationManager


LOCATION_SERVICE


GPS定位服务等


MediaRouter


MEDIA_ROUTER_SERVICE


Use with getSystemService(String) to retrieve a MediaRouter for controlling and managing routing of media.


NfcManager


NFC_SERVICE


Use with getSystemService(String) to retrieve a NfcManager for using NFC.

NFC


NotificationManager


NOTIFICATION_SERVICE


负责管理和通知后台事件的发生等,这个和statusbar胶黏在一起,一般会在statusbar上添加响应图标。用户可以通过这知道系统后台发生了什么事情。


NsdManager


NSD_SERVICE


Use with getSystemService(String) to retrieve a NsdManager for handling management of network service discovery


PowerManager


POWER_SERVICE


电源服务


PrintManager


PRINT_SERVICE


打印服务。打印和管理打印机和打印任务


SearchManager


SEARCH_SERVICE


搜索服务


SensorManager


SENSOR_SERVICE


传感器服务


StorageManager


STORAGE_SERVICE


系统存储服务


TelephonyManager


TELEPHONY_SERVICE


电话服务


TextServicesManager


TEXT_SERVICES_MANAGER_SERVICE


Use with getSystemService(String) to retrieve a TextServicesManager for accessing text services.


UiModeManager


UI_MODE_SERVICE


Use with getSystemService(String) to retrieve a UiModeManager for controlling UI modes.


UsbManager


USB_SERVICE


Use with getSystemService(String) to retrieve a UsbManager for access to USB devices (as a USB host) and for controlling this device‘s behavior as a USB device.


UserManager


USER_SERVICE


用户管理服务。在支持多用户设备上管理用户


Vibrator


VIBRATOR_SERVICE


振动器服务


com.android.server.

WallpaperService


WALLPAPER_SERVICE


壁纸服务


WifiP2pManager


WIFI_P2P_SERVICE


WIFI-P2P连接服务


WifiManager


WIFI_SERVICE


WIFI服务


WindowManager


WINDOW_SERVICE


系统窗口服务

Android常用系统服务,码迷,mamicode.com

时间: 2024-08-09 06:14:47

Android常用系统服务的相关文章

Android 常用系统服务

TelephonyManager类:管理手机通话状态,电话网络信息的服务类,获取方法为:     TelephonyManager manager=(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE)         常用方法:listen(PhoneStateListener listener,int events) 用来监听通话状态 SmsManager:短信服务类,常用方法:sendTextMessage(String,

Android常用开源项目

Android常用开源项目 Android   2014-05-23 16:39:43 发布 您的评价:       4.3   收藏     24收藏 Android开源项目第一篇--个性化控件(View)篇  包括ListView.ActionBar.Menu.ViewPager.Gallery.GridView.ImageView.ProgressBar.TextView.其他Android开源项目第二篇--工具库篇  包括依赖注入.图片缓存.网络相关.数据库ORM工具包.Android公

Android常用酷炫控件(开源项目)github地址汇总

转载一个很牛逼的控件收集贴... 第一部分 个性化控件(View) 主要介绍那些不错个性化的 View,包括 ListView.ActionBar.Menu.ViewPager.Gallery.GridView.ImageView.ProgressBar.TextView.ScrollView.TimeView.TipView.FlipView.ColorPickView.GraphView.UI Style 等等. 一.ListView android-pulltorefresh一个强大的拉动

Android常用面试题大全

1.TCP和UDP之间的区别?什么是URL ? TCP被称为用户数据报协议;UDP被称为信息传输控制协议;URL被称为统一资源定位符,通过统一资源定位符可以唯一定位到互联网上的某个资源(图片.视频.音频和网页等). 2.成员方法和构造方法有什么区别? 成员方法必须有返回类型,即使是没有返回,也要写上void:构造函数没有返回类型,而且和类名一样. 3.什么是栈? 栈是一种先进后出的线性表,只要符合先进后出的原则的线性表都是栈.至于采用的存储方式(实现方式)是顺序存储(顺序栈)还是链式存储(链式栈

Android常用控件:进度条

各种进度条属于 ProgressBar的子类 Sytle: 水平风格:Horizontal小风格:Small大风格:Large反向风格:Inverse小反向风格:Small.Inverse大反向风格:Large.Inverse 设置style:   style="?android:attr/progressBarStyle..." 主要属性:最大值:max当前进度:progress次要进度值:SecondaryProgress --效果类似于看电影那些缓冲 判断进度条是转圈还是水平的方

Android常用adb命令总结

Android 常用 adb 命令总结 首发个人博客 http://xuxu1988.com/2015/05/15/android-adb-commands , 转载请注明出处. 针对移动端 Android 的测试, adb 命令是很重要的一个点,必须将常用的 adb 命令熟记于心, 将会为 Android 测试带来很大的方便,其中很多命令将会用于自动化测试的脚本当中. Android Debug Bridge adb 其实就是 Android Debug Bridge, Android 调试桥

【转】 Android常用实例—Alert Dialog的使用

Android常用实例-Alert Dialog的使用 AlertDialog的使用很普遍,在应用中当你想要用户做出"是"或"否"或者其它各式各样的选择时,为了保持在同样的Activity和不改变用户屏幕,就可以使用AlertDialog. 代码地址 https://github.com/JueYingCoder/AndroidUsefulExample_AlertDialog 这篇文章主要讲解如何实现各种AlertDialog,文章比较长,如果能认真读完,Aler

[转载]android常用的API接口调用

原文地址:android常用的API接口调用作者:宋耀 显示网页:         Uri uri = Uri.parse("http://www.google.com"); Intent it = new Intent(Intent.ACTION_VIEW,uri); startActivity(it);显示地图: Uri uri = Uri.parse("geo:38.899533,-77.036476"); //Uri uri = Uri.parse(&quo

Android常用的工具类

主要介绍总结的Android开发中常用的工具类,大部分同样适用于Java.目前包括HttpUtils.DownloadManagerPro.ShellUtils.PackageUtils.PreferencesUtils.JSONUtils.FileUtils.ResourceUtils.StringUtils.ParcelUtils.RandomUtils.ArrayUtils.ImageUtils.ListUtils.MapUtils.ObjectUtils.SerializeUtils.S