Android API Chinese Document AccessibilityService

Source: Internet
Author: User

Android APIThe Chinese Document AccessibilityService is the content to be introduced in this article, mainly to understand and learnAndroid APIThe content of the help document.Android APIFor more information, see this article.

I. Android API Structure

 
 
  1. java.lang.Object   
  2. android.content.Context  
  3. android.content.ContextWrapper  
  4. android.app.Service  
  5. android.accessibilityservice.AccessibilityService  
  6. public abstract class AccessibilityService extends Service 

Ii. Android API Overview

In the Android API, when an AccessibilityEvent event is started, the AccessibilityService receives the callback function and runs it in the background. These events refer to status changes between user interfaces, such as focus changes, button is clicked. Some auxiliary services inherit from this class and implement its abstract methods. A service like this is declared in AndroidManifest. xml, but it must be specified for operation.

Android. accessibilityservice. AccessibilityService intent. The following is an example:

 
 
  1. <service android:name=".MyAccessibilityService"> 
  2. <intent-filter> 
  3. <action android:name="android.accessibilityservice.AccessibilityService" /> 
  4. </intent-filter> 
  5. </service> 

In Android APIs, the life cycle of the auxiliary service can only be managed by the system. To start or stop the service, a clear user must call onServiceConnected () in the system by enabling or disabling the device () after the method is bound to the service, this method can be used by the client that wants to execute the load. A secondary service sets the AccessibilityServiceInfo by calling the setServiceInfo (AccessibilityServiceInfo) method. You can change the configuration of this service at any time, but it is best to use it in the overload method onServiceConnected.

An auxiliary service can register events in a specific package to provide special feedback types and send a clear timeout reminder when the last associated event is released.

3. Android API announcement Policy

In the Android API, only one secondary service is notified for each feedback type, and the service registry is notified in order. Therefore, if two services are registered for the same feedback type in the same package, the first one will be notified. However, it is possible that, you can register a service as the default for a given feedback type. In this way, if no other service is used to replace this event, the service will be called out. In other words, the default service will not compete with other services and will be notified regardless of the order of registration.

Iv. Android API public methods:

 
 
  1. abstract void onAccessibilityEvent(AccessibilityEvent event) 

Callback AccessibilityEvents.

Parameters

Event

 
 
  1. public final IBinder onBind (Intent intent) 

The implementation returns the implementation of an internal secondary interface, and the subclass cannot be overwritten.

Parameters

Intent indicates the Intent bound to the service. Note that any other external intent contained in the Intent cannot be used here.

Return Value

Returns the IBinder that a client can access on the service.

 
 
  1. public abstract void onInterrupt () 

Call when the secondary feedback content is interrupted.

5. Android API protection methods:

 
 
  1. protected void onServiceConnected () 

This method is part of the AccessibilityService declaration cycle and is called only after the system is successfully bound to the service. This method is more convenient if it is used to set AccessibilityServiceInfo.

Summary:Android APIThe content of AccessibilityService in the Chinese document is described.Android APIDocument learning is helpful to you.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.