I want listen to incoming notifications and when i detect notification my app do somthing How can i do this? I search for this but i can't find answer Please help me
            Asked
            
        
        
            Active
            
        
            Viewed 102 times
        
    2 Answers
0
            
            
        NotificationListenerService
A service that receives calls from the system when new notifications are posted or removed, or their ranking changed.
Check from here
        Oussema Aroua
        
- 5,225
 - 1
 - 24
 - 44
 
- 
                    is there another way to do this on lower api?? for example api8 – erfan May 10 '16 at 22:06
 
0
            public class NotificationService extends AccessibilityService {
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    // TODO Auto-generated method stub.
//Code when the event is caught 
   }
@Override
public void onInterrupt() {
    // TODO Auto-generated method stub.
}
@Override
protected void onServiceConnected() {
    AccessibilityServiceInfo info = new AccessibilityServiceInfo();
      info.feedbackType = 1;
          info.eventTypes = AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED;
      info.notificationTimeout = 100; 
      setServiceInfo(info);
     }
}
And my Manifest is:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.test.notify"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
     <service android:name=".NotificationService" android:enabled="true">
            <intent-filter >
           <action android:name="android.intent.action.MAIN" />
           <category android:name="android.intent.category.LAUNCHER" />
           <action android:name="android.accessibilityservice.AccessibilityService"/>
        </intent-filter>
     </service>
   </application>
 </manifest>
founded here
        Community
        
- 1
 - 1
 
        Oussema Aroua
        
- 5,225
 - 1
 - 24
 - 44
 
- 
                    thanks bro :-) I work on this code and complete this with TYPE_NOTIFICATION_STATE_CHANGED event to listen to incoming notifications – erfan May 13 '16 at 18:16