Android : Call event in AccessibilityService returns null message

on Thursday, August 14, 2014


I am trying to subscribe to notification events on android using AccessibilityService on Android 2.3.x



@Override
public void onAccessibilityEvent(AccessibilityEvent event)
{
if (event.getEventType() == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED)
{
final String sourcePackageName = (String)event.getPackageName();
Parcelable parcelable = event.getParcelableData();
if (parcelable instanceof Notification)
{
List<CharSequence> messages = event.getText();
if (messages.size() > 0)
{
final String notificationMsg = (String) messages.get(0).toString();
Log.v("NotificationService", "Captured notification message [" + notificationMsg + "] for source [" + sourcePackageName + "]");
}
}
}


But for a incoming call event, the messages.size() == 0. How do we find out the caller ID from accessibility service otherwise.


0 comments:

Post a Comment