Flutter plugin for interacting with Accessibility Service in Android.

Overview

flutter_accessibility_service

a plugin for interacting with Accessibility Service in Android.

Accessibility services are intended to assist users with disabilities in using Android devices and apps, or I can say to get android os events like keyboard key press events or notification received events etc.

for more info check Accessibility Service

Installation and usage

Add package to your pubspec:

dependencies:
  flutter_accessibility_service: any # or the latest version on Pub

Inside AndroidManifest add this to bind your accessibility service with your application

    ...
    <service android:name="slayer.accessibility.service.flutter_accessibility_service.AccessibilityListener" android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
            <intent-filter>
                <action android:name="android.accessibilityservice.AccessibilityService" />
            </intent-filter>
            <meta-data android:name="android.accessibilityservice" android:resource="@xml/accessibilityservice" />
        </service>
    ...
</application>

Create Accesiblity config file named accessibilityservice.xml inside res/xml and add the following code inside it:

<?xml version="1.0" encoding="utf-8"?>
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
    android:accessibilityEventTypes = "typeWindowsChanged|typeWindowStateChanged|typeWindowContentChanged"
    android:accessibilityFeedbackType="feedbackVisual"
    android:notificationTimeout="300"
    android:accessibilityFlags="flagDefault|flagIncludeNotImportantViews|flagRequestTouchExplorationMode|flagRequestEnhancedWebAccessibility|flagReportViewIds|flagRetrieveInteractiveWindows"
    android:canRetrieveWindowContent="true"
>
</accessibility-service>

USAGE

 /// check if accessibility permession is enebaled
 final bool status = await FlutterAccessibilityService.isAccessibilityPermissionEnabled();
 
 /// request accessibility permission
 /// it will open the accessibility settings page and return `true` once the permission granted.
 final bool status = await FlutterAccessibilityService.requestAccessibilityPermission();
 
 /// stream the incoming Accessibility events
  FlutterAccessibilityService.accessStream.listen((event) {
    log("Current Event: $event");
  
  /*
  Current Event: AccessibilityEvent: (
     Action Type: 0 
     Event Time: 2022-04-11 14:19:56.556834 
     Package Name: com.facebook.katana 
     Event Type: EventType.typeWindowContentChanged 
     Captured Text: events you may like 
     content Change Types: ContentChangeTypes.contentChangeTypeSubtree 
     Movement Granularity: 0
     Is Active: true
     is focused: true
     in Pip: false
     window Type: WindowType.typeApplication
)
  */
  
  });

The AccessibilityEvent provides:

  /// the performed action that triggered this event
  int? actionType;
  
  /// the time in which this event was sent.
  DateTime? eventTime;
  
  /// the package name of the source
  String? packageName;
  
  /// the event type.
  EventType? eventType;
  
  /// Gets the text of this node.
  String? capturedText;
  
  /// the bit mask of change types signaled by a `TYPE_WINDOW_CONTENT_CHANGED` event or `TYPE_WINDOW_STATE_CHANGED`. A single event may represent multiple change types
  ContentChangeTypes? contentChangeTypes;
  
  /// the movement granularity that was traversed
  int? movementGranularity;
  
  /// the type of the window
  WindowType? windowType;
  
  /// check if this window is active. An active window is the one the user is currently touching or the window has input focus and the user is not touching any window.
  bool? isActive;
  
  /// check if this window has input focus.
  bool? isFocused;
  
  /// Check if the window is in picture-in-picture mode.
  bool? isPip;

  /// Gets the node bounds in screen coordinates.
  ScreenBounds? screenBounds;

for each event.

You might also like...

This is an example project for the article about implementing clean architecture in flutter with riverpod and supabase as backend service.

The Example This is an example how to implement clean architecture with domain driven design and riverpod in flutter projects. Getting Started Rename

Dec 30, 2022

Push Notification service for anime episodes and news. The episode updates will be based on actual upload on the internet and NOT Japan tv schedule as other apps do.

Push Notification service for anime episodes and news. The episode updates will be based on actual upload on the internet and NOT Japan tv schedule as other apps do.

Quantz Push Notification service for anime episodes and news. Features Sub and dub - get notified with latest anime episodes on the internet. Ongoing

Nov 21, 2022

A demo Project Showcasing HowTo use GraphQL to conect as a client to a GraphQL service.

graphql_demoapp A Flutter App to demonstrate how to work with GraphQL Server, connecting through our app as a client. Working with basic queries and m

Nov 7, 2021

An open source food delivery product and service that will be developed on the FilledStacks YouTube channel

Box't Out An open source food delivery product and service that will be developed on the FilledStacks YouTube channel. The repo will contain all the s

Jan 7, 2023

This project is Riot game information check service using Riot api.

riot_api_project this project is Riot game information check service using Riot api. Getting Started This project is a starting point for a Flutter ap

Dec 12, 2021

Get It - Simple direct Service Locator that allows to decouple the interface from a concrete implementation and to access the concrete implementation from everywhere in your App. Maintainer: @escamoteur

Get It - Simple direct Service Locator that allows to decouple the interface from a concrete implementation and to access the concrete implementation from everywhere in your App. Maintainer: @escamoteur

❤️ Sponsor get_it This is a simple Service Locator for Dart and Flutter projects with some additional goodies highly inspired by Splat. It can be used

Jan 1, 2023

Imgix package for Dart. Imgix is a CDN service with support for realtime image processing and optimization.

Imgix package for Dart. Imgix is a CDN service with support for realtime image processing and optimization.

Jan 24, 2022

Ensdart - A dart library that wraps the Ethereum Name Service

⚡️ ENS Dart A dart library that wraps the Ethereum Name Service. The Ethereum Na

Nov 29, 2022

Toor makes service locators compile-time safe and easy to manage

🌱 What is Toor Toor makes service locators compile-time safe and easy to manage. 🚀 Getting Started Define your dependencies somewhere in the project

Jul 25, 2022
Comments
  • Stream stops when app is closed

    Stream stops when app is closed

    Hello,

    Thank you for this. Is it normal that the stream stops when the app is closed ? I have used Accessibility Service on Android app before and even if the app is closed, the streams continue. Is there any way to achieve the same with this plugin ? Like using an isolate or something like that?

    Thanks

    opened by tolotrasamuel 1
  • Its doesn't working on Android 12

    Its doesn't working on Android 12

    Its doesn't working on Android 12: I have did the installation of the plugin, and tried to reproduce the list on Start Stream example, and doesn't wok.

    My setup:

    pubspec.yml
    
    environment:
      sdk: '>=2.18.1 <3.0.0'
    
    dependencies:
      flutter:
        sdk: flutter
      flutter_accessibility_service: ^0.2.2
      flutter_local_notifications: ^12.0.3
      http: ^0.13.5
    
    
    opened by seealex 1
  • There are some questions before use

    There are some questions before use

    hi

    I was looking for information about flutter accessibility service and found this project, it's really an interesting project

    However, I am not an android developer, can this project help me to control other APPs?

    For example, can I use this project to control android to automatically click on an application? Do something automatically after opening the app?

    Looking forward to your help, thank you

    opened by endachao 1
Owner
Iheb Briki
I'm a full-stack developer and mainly use Flutter, ReactJs, MeteorJs & .NET. trying to be better every day @PixeliumTN
Iheb Briki
Home-Service-App - Home Service App Built With Flutter

Home-Service-App Home Service App Sample Images

Justin Roy 2 Sep 4, 2022
Our application, MyArmyPal serves to be an all in one service for our service men.

Our application, MyArmyPal serves to be an all in one service for our service men. It seeks to provide convenience and useful features just one tap away. Its main features include an IPPT Calculator, reservist checklist, customized IPPT training plan according to the user's current fitness level and a canteen order pick up service in all army camps. We are also implementing an anytime Eliss system using computer vision for users to check on their push up form easily.

Poh Wei Pin 3 Jun 17, 2022
Click - Interacting with svg in flutter

click Interacting with svg in flutter Getting Started This project is a starting point for a Flutter application. A few resources to get you started i

Samuel Abada 11 Dec 20, 2022
A Flutter application that allows interacting with Pokemons, built using Clean Archtitecture structure and riverpod as state management.

pokedex Welcome to the Pokedex project! Getting Started Instructions to run: This project uses flutter version 3.0.3, Make sure you have that version

null 25 Nov 22, 2022
Dart API Library for interacting with the TRON Network

Dart API Library for interacting with the TRON Network. Getting started In your

Mahdi K. Fard 5 Dec 20, 2022
A Dart SDK for interacting with a Minecraft server using the RCON protocol.

A Dart SDK for interacting with a Minecraft server using the RCON protocol. Package on pub.dev Features Provides an API to connect to, log in to, send

Aidan Lok 2 Oct 4, 2022
Flutter plugin for authenticating a user with a web service

A Flutter plugin for authenticating a user with a web service, even if the web service is run by a third party. Most commonly used with OAuth2, but can be used with any web flow that can redirect to a custom scheme.

Linus Unnebäck 170 Jan 3, 2023
Yumniastic is a online food delivery service app built with Flutter and Django

Welcome to Flutter Yumniastic ?? Yumniastic is a online food delivery service app built with Flutter and Django ?? See Screenshots See ScreenShots Dow

null 21 Dec 26, 2022
Flutter Wallpaper service app

Walls Your phone wallpaper is great way to express your unique personality. Walls is a wallpaper service app with out any Ads. check this blog post Be

Naveen Jujaray 25 Dec 16, 2022
MVC pattern for flutter. Works as state management, dependency injection and service locator.

MVC pattern for flutter. Works as state management, dependency injection and service locator. Model View Controller Here's a diagram describing the fl

xamantra 115 Dec 12, 2022