{"id":14956410,"url":"https://github.com/x-slayer/flutter_accessibility_service","last_synced_at":"2025-04-09T14:08:10.748Z","repository":{"id":55057518,"uuid":"480175368","full_name":"X-SLAYER/flutter_accessibility_service","owner":"X-SLAYER","description":"Flutter plugin for interacting with Accessibility Service in Android.","archived":false,"fork":false,"pushed_at":"2024-11-22T09:36:31.000Z","size":162,"stargazers_count":40,"open_issues_count":15,"forks_count":32,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-02T11:55:29.194Z","etag":null,"topics":["accessibility","accessibilityservice","flutter","pub-dev","x-slayer"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/flutter_accessibility_service","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/X-SLAYER.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-11T00:26:46.000Z","updated_at":"2025-03-10T10:58:52.000Z","dependencies_parsed_at":"2022-08-14T10:30:38.398Z","dependency_job_id":"d3501caf-7231-4874-b84a-f0791ea7d21a","html_url":"https://github.com/X-SLAYER/flutter_accessibility_service","commit_stats":{"total_commits":48,"total_committers":3,"mean_commits":16.0,"dds":0.125,"last_synced_commit":"6d07d1f87159f51f65bc1602a94a346d1f10d8aa"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/X-SLAYER%2Fflutter_accessibility_service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/X-SLAYER%2Fflutter_accessibility_service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/X-SLAYER%2Fflutter_accessibility_service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/X-SLAYER%2Fflutter_accessibility_service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/X-SLAYER","download_url":"https://codeload.github.com/X-SLAYER/flutter_accessibility_service/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246811305,"owners_count":20837751,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["accessibility","accessibilityservice","flutter","pub-dev","x-slayer"],"created_at":"2024-09-24T13:13:00.493Z","updated_at":"2025-04-02T12:08:11.091Z","avatar_url":"https://github.com/X-SLAYER.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flutter_accessibility_service\n\na plugin for interacting with Accessibility Service in Android.\n\nAccessibility 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.\n\nfor more info check [Accessibility Service](https://developer.android.com/reference/android/accessibilityservice/AccessibilityService)\n\n### Installation and usage\n\nAdd package to your pubspec:\n\n```yaml\ndependencies:\n  flutter_accessibility_service: any # or the latest version on Pub\n```\n\nInside AndroidManifest add this to bind your accessibility service with your application\n\n```xml\n    .\n    .\n    \u003cservice android:name=\"slayer.accessibility.service.flutter_accessibility_service.AccessibilityListener\"\n                android:permission=\"android.permission.BIND_ACCESSIBILITY_SERVICE\" android:exported=\"false\"\u003e\n      \u003cintent-filter\u003e\n        \u003caction android:name=\"android.accessibilityservice.AccessibilityService\" /\u003e\n      \u003c/intent-filter\u003e\n      \u003cmeta-data android:name=\"android.accessibilityservice\" android:resource=\"@xml/accessibilityservice\" /\u003e\n    \u003c/service\u003e\n    .\n    .\n\u003c/application\u003e\n\n```\n\nCreate Accesiblity config file named `accessibilityservice.xml` inside `res/xml` and add the following code inside it:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003caccessibility-service xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:accessibilityEventTypes=\"typeWindowsChanged|typeWindowStateChanged|typeWindowContentChanged\"\n    android:accessibilityFeedbackType=\"feedbackVisual\"\n    android:notificationTimeout=\"300\"\n    android:accessibilityFlags=\"flagDefault|flagIncludeNotImportantViews|flagRequestTouchExplorationMode|flagRequestEnhancedWebAccessibility|flagReportViewIds|flagRetrieveInteractiveWindows\"\n    android:canRetrieveWindowContent=\"true\"\n\u003e\n\u003c/accessibility-service\u003e\n\n```\n\n### USAGE\n\n```dart\n /// check if accessibility permission is enebaled\n final bool status = await FlutterAccessibilityService.isAccessibilityPermissionEnabled();\n\n /// request accessibility permission\n /// it will open the accessibility settings page and return `true` once the permission granted.\n final bool status = await FlutterAccessibilityService.requestAccessibilityPermission();\n\n /// stream the incoming Accessibility events\n  FlutterAccessibilityService.accessStream.listen((event) {\n    log(\"Current Event: $event\");\n\n  /*\n  Current Event: AccessibilityEvent: (\n     Action Type: 0\n     Event Time: 2022-04-11 14:19:56.556834\n     Package Name: com.facebook.katana\n     Event Type: EventType.typeWindowContentChanged\n     Captured Text: events you may like\n     content Change Types: ContentChangeTypes.contentChangeTypeSubtree\n     Movement Granularity: 0\n     Is Active: true\n     is focused: true\n     in Pip: false\n     window Type: WindowType.typeApplication\n     Screen bounds: left: 0 - right: 720 - top: 0 - bottom: 1544 - width: 720 - height: 1544\n)\n  */\n\n  });\n```\n\nThe `AccessibilityEvent` provides:\n\n```dart\n  /// the performed action that triggered this event\n  int? actionType;\n\n  /// the time in which this event was sent.\n  DateTime? eventTime;\n\n  /// the package name of the source\n  String? packageName;\n\n  /// the event type.\n  EventType? eventType;\n\n  /// Gets the text of this node.\n  String? capturedText;\n\n  /// 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\n  ContentChangeTypes? contentChangeTypes;\n\n  /// the movement granularity that was traversed\n  int? movementGranularity;\n\n  /// the type of the window\n  WindowType? windowType;\n\n  /// 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.\n  bool? isActive;\n\n  /// check if this window has input focus.\n  bool? isFocused;\n\n  /// Check if the window is in picture-in-picture mode.\n  bool? isPip;\n\n  /// Gets the node bounds in screen coordinates.\n  ScreenBounds? screenBounds;\n\n  /// Get the node childrens and sub childrens text\n  List\u003cString\u003e? nodesText;\n```\n\n### AUTOMATION \u0026 ACTIONS\n\nPerform actions with `Accessibility Service`\n\n```dart\n  /// perform a click action\n final hasBeenClicked = await FlutterAccessibilityService.performAction(\n              event.nodeId!,\n              NodeAction.actionClick,\n            );\n          }\n```\n\n| Enum Value                            | Description                                                                                                                                                                                                                                | Arguments/Example                                                      |\n| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------- |\n| `actionAccessibilityFocus`            | Action that gives accessibility focus to the node.                                                                                                                                                                                         |                                                                        |\n| `actionClearAccessibilityFocus`       | Action that clears accessibility focus of the node.                                                                                                                                                                                        |                                                                        |\n| `actionClearFocus`                    | Action that clears input focus of the node.                                                                                                                                                                                                |                                                                        |\n| `actionClearSelection`                | Action that deselects the node.                                                                                                                                                                                                            |                                                                        |\n| `actionClick`                         | Action that clicks on the node.                                                                                                                                                                                                            |                                                                        |\n| `actionCollapse`                      | Action to collapse an expandable node.                                                                                                                                                                                                     |                                                                        |\n| `actionCopy`                          | Action to copy the current selection to the clipboard.                                                                                                                                                                                     |                                                                        |\n| `actionCut`                           | Action to cut the current selection and place it to the clipboard.                                                                                                                                                                         |                                                                        |\n| `actionDismiss`                       | Action to dismiss a dismissable node.                                                                                                                                                                                                      |                                                                        |\n| `actionExpand`                        | Action to expand an expandable node.                                                                                                                                                                                                       |                                                                        |\n| `actionFocus`                         | Action that gives input focus to the node.                                                                                                                                                                                                 |                                                                        |\n| `actionLongClick`                     | Action that long clicks on the node.                                                                                                                                                                                                       |                                                                        |\n| `actionNextAtMovementGranularity`     | Action that requests to go to the next entity in this node's text at a given movement granularity. Pass an argument when you perform an action.                                                                                            | `boolean`                                                              |\n| `actionNextHtmlElement`               | Action to move to the next HTML element of a given type. Pass an argument when you perform an action.                                                                                                                                      | `NodeAction.actionNextHtmlElement` with argument `\"BUTTON\"`            |\n| `actionPaste`                         | Action to paste the current clipboard content.                                                                                                                                                                                             |                                                                        |\n| `actionPreviousAtMovementGranularity` | Action that requests to go to the previous entity in this node's text at a given movement granularity. Pass an argument when you perform an action.                                                                                        | `NodeAction.actionPreviousAtMovementGranularity` with argument `false` |\n| `actionPreviousHtmlElement`           | Action to move to the previous HTML element of a given type. Pass an argument when you perform an action.                                                                                                                                  | `NodeAction.actionPreviousHtmlElement` with argument `\"BUTTON\"`        |\n| `actionScrollBackward`                | Action to scroll the node content backward.                                                                                                                                                                                                |                                                                        |\n| `actionScrollForward`                 | Action to scroll the node content forward.                                                                                                                                                                                                 |                                                                        |\n| `actionSelect`                        | Action that selects the node.                                                                                                                                                                                                              |                                                                        |\n| `actionSetSelection`                  | Action to set the selection. Performing this action with no arguments clears the selection. Pass an argument when you perform an action.                                                                                                   | `NodeAction.actionSetSelection` with argument `{\"start\": 1, \"end\": 2}` |\n| `actionSetText`                       | Action that sets the text of the node. Performing the action without argument, using null or empty CharSequence will clear the text. This action will also put the cursor at the end of text. Pass an argument when you perform an action. | `NodeAction.actionSetText` with argument `\"Flutter\"`                   |\n| `focusAccessibility`                  | The accessibility focus.                                                                                                                                                                                                                   |                                                                        |\n| `focusInput`                          | The input focus.                                                                                                                                                                                                                           |                                                                        |\n| `movementGranularityCharacter`        | Movement granularity bit for traversing the text of a node by character.                                                                                                                                                                   |                                                                        |\n| `movementGranularityLine`             | Movement granularity bit for traversing the text of a node by line.                                                                                                                                                                        |                                                                        |\n| `movementGranularityPage`             | Movement granularity bit for traversing the text of a node by page.                                                                                                                                                                        |                                                                        |\n| `movementGranularityParagraph`        | Movement granularity bit for traversing the text of a node by paragraph.                                                                                                                                                                   |                                                                        |\n| `movementGranularityWord`             | Movement granularity bit for traversing the text of a node by word.                                                                                                                                                                        |                                                                        |\n| `unknown`                             | Unknown action.                                                                                                                                                                                                                            |                                                                        |\n\nFor more details about the action check [here](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.AccessibilityAction)\n\n#### Accessibility Overlay\n\nThis will help to cover the window with an overlay by an accessibility service\n\nInside main.dart creates an entry point for your Accessibility Overlay widget;\n\n```dart\n@pragma(\"vm:entry-point\")\nvoid accessibilityOverlay() {\n  runApp(const MaterialApp(\n    debugShowCheckedModeBanner: false,\n    home: Material(child: Text(\"My Accessibility Overlay\"))\n  ));\n}\n```\n\nUsage\n\n```dart\n/// Show overlay\n await FlutterAccessibilityService.showOverlayWindow();\n\n/// hide overlay\n await FlutterAccessibilityService.hideOverlayWindow();\n```\n\n#### Perform Global Actions\n\nSuch an action can be performed at any moment regardless of the current application or user location in that application\nFor example going back, going home, opening recents, etc.\n\n```dart\n  await FlutterAccessibilityService.performGlobalAction(\n    GlobalAction.globalActionTakeScreenshot,\n  );\n```\n\nReturns a list of system actions available in the system right now.\n\n```dart\n  final list = await FlutterAccessibilityService.getSystemActions();\n  print(list); // [GlobalAction.globalActionAccessibilityAllApps,GlobalAction.globalActionTakeScreenshot .....]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx-slayer%2Fflutter_accessibility_service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fx-slayer%2Fflutter_accessibility_service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx-slayer%2Fflutter_accessibility_service/lists"}