0

Is there a way to have the new Android NotificationListenerService gracefully degrade for versions prior to 4.3?

I thought that if the os does not recoginze a service then it is ignored in the manifest. This doesn't seem to be the case here. The following is what is in the manifest.

        <service android:name=".services.NotificationListener"
            android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
            <intent-filter>
                <action android:name=
                    "android.service.notification.NotificationListenerService" />
            </intent-filter>
        </service>

Thanks!

  • "Is there a way to have the new Android NotificationManager service gracefully degrade for versions prior to 4.3?" -- `NotificationManager` has been around since Android 1.0. "This doesn't seem to be the case here" -- please explain **completely and precisely** what your symptoms are. – CommonsWare Aug 01 '14 at 22:44
  • @CommonsWare Sorry I should have mentioned that it is the NotificationListenerService. Basically for android 4.3 and lower, it seems to be crashing the app. – Victor Parmar Aug 03 '14 at 03:09
  • "it seems to be crashing the app" -- what is the stack trace? – CommonsWare Aug 03 '14 at 10:59

1 Answers1

0

To close the loop on this, the problem was that we were using a dependency injection framework that required we plugin our dependencies into generated class files and in the case of NotificationListener, this class isn't available for 4.3 and below so that was what was crashing the app.

The solution involved creating a proxy for the NotificationListener and plugging the depedencies into the proxy so the app works for pre and post 4.3 android versions :)