ContextWrapper.GetSystemService(String) Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Devuelve el identificador a un servicio de nivel de sistema por nombre.
[Android.Runtime.Register("getSystemService", "(Ljava/lang/String;)Ljava/lang/Object;", "GetGetSystemService_Ljava_lang_String_Handler")]
public override Java.Lang.Object? GetSystemService(string? name);
[<Android.Runtime.Register("getSystemService", "(Ljava/lang/String;)Ljava/lang/Object;", "GetGetSystemService_Ljava_lang_String_Handler")>]
override this.GetSystemService : string -> Java.Lang.Object
Parámetros
- name
- String
Nombre del servicio deseado.
Devoluciones
Devuelve el identificador a un servicio de nivel de sistema por nombre. La clase del objeto devuelto varía según el nombre solicitado. Los nombres disponibles actualmente son: WINDOW_SERVICE ("ventana") El administrador de ventanas de nivel superior en el que puede colocar ventanas personalizadas. El objeto devuelto es un WindowManager . Solo se debe obtener de un contexto visual, como Activity o Context creado con createWindowContext(int,Bundle), que se ajustan a los límites visuales y de configuración de un área en pantalla. LAYOUT_INFLATER_SERVICE ("layout_inflater") Un LayoutInflater para inflar los recursos de diseño en este contexto. Solo se debe obtener de un contexto visual, como Activity o Context creado con createWindowContext(int,Bundle), que se ajustan a los límites visuales y de configuración de un área en pantalla. ACTIVITY_SERVICE ("actividad") Un ActivityManager para interactuar con el estado de actividad global del sistema. WALLPAPER_SERVICE ("wallpaper") A WallpaperService para acceder a fondos de pantalla en este contexto. Solo se debe obtener de un contexto visual, como Activity o Context creado con createWindowContext(int,Bundle), que se ajustan a los límites visuales y de configuración de un área en pantalla. POWER_SERVICE ("power") Un PowerManager para controlar la administración de energía. ALARM_SERVICE ("alarma") Un AlarmManager para recibir intenciones en el momento de su elección. NOTIFICATION_SERVICE ("notificación") Un NotificationManager para informar al usuario de eventos en segundo plano. KEYGUARD_SERVICE ("keyguard") Un KeyguardManager para controlar keyguard. LOCATION_SERVICE ("ubicación") Un LocationManager para controlar las actualizaciones de ubicación (por ejemplo, GPS). SEARCH_SERVICE ("buscar") Un SearchManager para controlar la búsqueda. VIBRATOR_MANAGER_SERVICE ("vibrator_manager") Un VibratorManager para acceder a los vibradores del dispositivo, interactuar con los individuales y reproducir efectos sincronizados en varios vibradores. ERROR(/#MULTISENSORY_MANAGER_SERVICE) ("multisensory_manager") A ERROR(/android.os.multisensory.MultisensoryManager) para entregar comentarios hápticos de audio en el Sistema de diseño multisensorial VIBRATOR_SERVICE ("vibrador") Un vibrador para interactuar con el hardware vibrador. CONNECTIVITY_SERVICE ("conectividad") Un ConnectivityManager para controlar la administración de las conexiones de red. IPSEC_SERVICE ("ipsec") A IpSecManager para administrar IPSec en sockets y redes. WIFI_SERVICE ("wifi") A WifiManager para la administración de Wi-Fi conectividad. En las versiones anteriores a Android 7, solo se debe obtener de un contexto de aplicación y no de ningún otro contexto derivado para evitar pérdidas de memoria dentro del proceso de llamada. WIFI_AWARE_SERVICE ("wifiaware") A WifiAwareManager para la administración de Wi-Fi detección y conectividad compatibles. WIFI_P2P_SERVICE ("wifip2p") A WifiP2pManager para la administración de Wi-Fi conectividad directa. INPUT_METHOD_SERVICE ("input_method") InputMethodManager para la administración de métodos de entrada. UI_MODE_SERVICE ("uimode") Un UiModeManager para controlar los modos de interfaz de usuario. DOWNLOAD_SERVICE ("download") Un DownloadManager para solicitar descargas HTTP BATTERY_SERVICE ("batterymanager") Un BatteryManager para administrar el estado de la batería JOB_SCHEDULER_SERVICE ("taskmanager") Un JobScheduler para administrar tareas programadas NETWORK_STATS_SERVICE ("netstats") A NetworkStatsManager para consultar estadísticas de uso de red. HARDWARE_PROPERTIES_SERVICE ("hardware_properties") Un HardwarePropertiesManager para acceder a las propiedades de hardware. DOMAIN_VERIFICATION_SERVICE ("domain_verification") A DomainVerificationManager para acceder al estado de aprobación del dominio web. DISPLAY_HASH_SERVICE ("display_hash") DisplayHashManager para la administración de hashes de visualización. ERROR(/#AUTHENTICATION_POLICY_SERVICE) ("authentication_policy") AuthenticationPolicyManager para administrar directivas relacionadas con la autenticación en el dispositivo. Nota: Los servicios del sistema obtenidos a través de esta API pueden estar estrechamente asociados con el contexto en el que se obtienen. En general, no comparta los objetos de servicio entre distintos contextos (Actividades, Aplicaciones, Servicios, Proveedores, etc.) Nota: Las aplicaciones instantáneas, para las que PackageManager.isInstantApp() devuelve true, no tienen acceso a los siguientes servicios del sistema: DEVICE_POLICY_SERVICE , ERROR(/#FINGERPRINT_SERVICE) , KEYGUARD_SERVICE , SHORTCUT_SERVICE , USB_SERVICE , WALLPAPER_SERVICE , WIFI_P2P_SERVICE , WIFI_SERVICE , WIFI_AWARE_SERVICE . Para estos servicios, este método devolverá null . Por lo general, si se ejecuta como una aplicación instantánea, siempre debe comprobar si el resultado de este método es NULL . Nota: Al implementar este método, tenga en cuenta que los nuevos servicios se pueden agregar en versiones más recientes de Android, por lo que si busca solo los nombres explícitos mencionados anteriormente, asegúrese de devolver null cuando no reconozca el nombre, si inicia una excepción RuntimeException en su lugar, la aplicación podría interrumpir las nuevas versiones de Android. Nombre de parámetros String: nombre del servicio deseado. El valor es uno de los siguientes: Context.POWER_SERVICE Context.WINDOW_SERVICE Context.LAYOUT_INFLATER_SERVICE Context.ACCOUNT_SERVICE Context.ACTIVITY_SERVICE Context.ALARM_SERVICE Context.NOTIFICATION_SERVICE Context.ACCESSIBILITY_SERVICE Context.CAPTIONING_SERVICE Context.KEYGUARD_SERVICE Context.LOCATION_SERVICE Context.HEALTHCONNECT_SERVICE Context.SEARCH_SERVICE Context.SENSOR_SERVICE Context.STORAGE_SERVICE Context.STORAGE_STATS_SERVICE Context.WALLPAPER_SERVICE Context.VIBRATOR_MANAGER_SERVICE Context.VIBRATOR_SERVICE Context.CONNECTIVITY_SERVICE Context.TETHERING_SERVICE Context.IPSEC_SERVICE Context.VPN_MANAGEMENT_SERVICE Context.NETWORK_STATS_SERVICE Context.WIFI_SERVICE Context.WIFI_AWARE_SERVICE Context.WIFI_P2P_SERVICE Context.WIFI_RTT_RANGING_SERVICE Context.NSD_SERVICE Context.AUDIO_SERVICE Context.BIOMETRIC_SERVICE Context.MEDIA_ROUTER_SERVICE Context.TELEPHONY_SERVICE Context.TELEPHONY_SUBSCRIPTION_SERVICE Context.TELEPHONY_PHONE_NUMBER_SERVICE Context.CARRIER_CONFIG_SERVICE Context.EUICC_SERVICE Context.TELECOM_SERVICE Context.CLIPBOARD_SERVICE Context.INPUT_METHOD_SERVICE Context.TEXT_SERVICES_MANAGER_SERVICE Context.TEXT_CLASSIFICATION_SERVICE Context.APPWIDGET_SERVICE Context.DROPBOX_SERVICE Context.DEVICE_POLICY_SERVICE Context.UI_MODE_SERVICE Context.DOWNLOAD_SERVICE Context.NFC_SERVICE Context.BLUETOOTH_SERVICE Context.USB_SERVICE Context.LAUNCHER_APPS_ SERVICE Context.SERIAL_SERVICE Context.INPUT_SERVICE Context.DISPLAY_SERVICE Context.USER_SERVICE Context.RESTRICTIONS_SERVICE Context.APP_OPS_SERVICE Context.ROLE_SERVICE Context.CAMERA_SERVICE Context.PRINT_SERVICE Context.CONSUMER_IR_SERVICE Context.TV_INTERACTIVE_APP_SERVICE Context.TV_INPUT_SERVICE Context.USAGE_STATS_SERVICE Context.MEDIA_SESSION_SERVICE Context.MEDIA_COMMUNICATION_SERVICE Context.BATTERY_SERVICE Context.JOB_SCHEDULER_SERVICE Context.PERSISTENT_DATA_BLOCK_SERVICE Context.MEDIA_PROJECTION_SERVICE Context.MIDI_SERVICE Context.HARDWARE_PROPERTIES_SERVICE Context.SHORTCUT_SERVICE Context.SYSTEM_HEALTH_SERVICE Context.COMPANION_DEVICE_SERVICE Context.VIRTUAL_DEVICE_SERVICE Context.CROSS_PROFILE_APPS_SERVICE Context.LOCALE_SERVICE Context.MEDIA_METRICS_SERVICE Context.DISPLAY_HASH_SERVICE Context.CREDENTIAL_SERVICE Context.DEVICE_LOCK_SERVICE Context.GRAMMATICAL_INFLECTION_SERVICE Context.SECURITY_STATE_SERVICE Context.CONTACT_KEYS_SERVICE Context.MEDIA_QUALITY_SERVICE Context.ADVANCED_PROTECTION_SERVICE Context.NPU_SERVICE Context.WEB_APP_SERVICE Context.HID_SERVICE . Este valor no puede ser null. Devuelve Object El servicio o null si el nombre no existe.
- Atributos
Comentarios
Las partes de esta página son modificaciones basadas en el trabajo creado y compartido por el Android y se usan según los términos descritos en creative Creative Commons 2.5 Attribution License.
Java documentación para android.content.ContextWrapper.getSystemService(java.lang.String).