java - onAccessibilityEvent not called in Kitkat -
i building app listens notifications , display onto calendar using accessibilityservice , whenever receive notification (i'm using emails test continually send mail myself) onaccessibilityservice never called , referred answers around here point jellybean think not case i'm looking
in accessibilitylistener.class
@override public void onaccessibilityevent(accessibilityevent event) { final int eventtype = event.geteventtype(); notificationinfo info = new notificationinfo(); toast.maketext(getapplicationcontext(), "received event", 1000); log.d("tag","onaccessibility event running"); if (event.geteventtype() == accessibilityevent.type_notification_state_changed) { info.packagename = (string) event.getpackagename(); info.eventtime = event.geteventtime(); info.eventtext = event.gettext().tostring(); sendevent(info); } }
in android.manifest
<service android:enabled="true" android:name=".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>
in accessibilityservice.xml in res/xml
<?xml version="1.0" encoding="utf-8"?> <accessibility-service xmlns:android="http://schemas.android.com/apk/res/android" android:accessibilityeventtypes="typenotificationstatechanged" android:accessibilityfeedbacktype="feedbackallmask" android:notificationtimeout="100" />
Comments
Post a Comment