3

Was there anyway to find the application which is responsible for statusBar notification?.

One way of finding is selecting the notification Icon. But, if application doesn't add launcher to it, it will be hard to find out. Please let me know if you know any other way to find it. Thanks.

Sukumar
  • 1,303
  • 10
  • 15
  • Is this on a stock/retail device, or are you working within the AOSP source tree? – scorpiodawg Jun 19 '12 at 21:31
  • hi, I need to find it on a Android phone. Stock/retail devices makes a difference for finding?. I'm not working on any AOSP, its a general query I have about notifcations. – Sukumar Jun 20 '12 at 10:58

1 Answers1

1

I already posted the answer in Detect a new Android notification:

You need to register an AccessibilityService and make sure the user enables the service.

Example for a service:

public class InstantMessenger extends AccessibilityService {

@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    if (event.getEventType() == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED) {
        //Do something, eg getting packagename
        final String packagename = String.valueOf(event.getPackageName());  
}
}

@Override
protected void onServiceConnected() {
    if (isInit) {
        return;
    }
    AccessibilityServiceInfo info = new AccessibilityServiceInfo();
    info.eventTypes = AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED;
    info.feedbackType = AccessibilityServiceInfo.FEEDBACK_SPOKEN;
    setServiceInfo(info);
    isInit = true;
}

@Override
public void onInterrupt() {
    isInit = false;
}
}
Community
  • 1
  • 1
Force
  • 6,312
  • 7
  • 54
  • 85