0

I'm trying to implement a service that gets generally any text from current view or current foreground context , i'm sure android talk back in android kitkat implements this before passing the text to tts.

Any idea what Apis should be used for this?

user2469133
  • 1,940
  • 3
  • 21
  • 33
  • is this service trying to read views from your app, or another app? – NameSpace Nov 08 '14 at 18:13
  • another app, just like the talk back feature in android kitkat – user2469133 Nov 08 '14 at 18:16
  • 1
    I think you need to read about accessibility : https://developer.android.com/reference/android/R.styleable.html#AccessibilityService_accessibilityEventTypes https://developer.android.com/guide/topics/ui/accessibility/index.html . I didn't read about it, so this is just a guess... – android developer Nov 08 '14 at 18:37
  • Yes, you would want to create an AccessibilityService. There's a tutorial available on the Android Developers site: http://developer.android.com/training/accessibility/service.html – alanv Nov 09 '14 at 02:00

1 Answers1

0

The Android Accessibility service did what i want :

http://developer.android.com/training/accessibility/service.html

and i found a simple example :https://gist.github.com/qihnus/1909616 but it needs to modify your manifest.

check here: http://developer.android.com/guide/topics/ui/accessibility/services.html

Also some Apis were declared from Android Ice Cream Sandwich or up but you can still access them using support libraries.

This is a general answer but you can do whatever from these links.

Remember to check if Accessibility is enabled or not:

Detect if my accessibility service is enabled

and if not enabled you can fire an intent to the setting to make user manually enable it, since you can not enable Android Accessibility programmatically.

Community
  • 1
  • 1
user2469133
  • 1,940
  • 3
  • 21
  • 33