Code example for AccessibilityServiceInfo

     *   Note: The feedbackType parameter is an bitwise or of all 
     *   feedback types this service would like to provide. 
     * </p> 
    private void setServiceInfo(int feedbackType) {
        AccessibilityServiceInfo info = new AccessibilityServiceInfo();
        // We are interested in all types of accessibility events. 
        info.eventTypes = AccessibilityEvent.TYPES_ALL_MASK;
        // We want to provide specific type of feedback. 
        info.feedbackType = feedbackType;
        // We want to receive events in a certain interval. 
        info.notificationTimeout = EVENT_NOTIFICATION_TIMEOUT_MILLIS;
        // We want to receive accessibility events only from certain packages. 
        info.packageNames = PACKAGE_NAMES;
    public void onAccessibilityEvent(AccessibilityEvent event) {
        Log.i(LOG_TAG, mProvidedFeedbackType + " " + event.toString());
Contextual code suggestions in your IDE  Get Codota for Java