onNotificationPosted not being called after some time

I use NotificationListenerService to catch notifications and elaborate them in my application. App works great and onNotificationPosted is always called, but after a while (Few hours) it stops being called and the app stops working.

It gets back to work only if I reboot my device or if I revoke and grant again notification access to the application.

Important info

  • App does have notification access enabled.
  • App does have service on AndroidManifest.

                 <action android:name="android.service.notification.NotificationListenerService"/>
  • App is a release version (Same problem on debug version though).

  • It has been tested on Android Lollipop, Marshmallow and Nougat, same result.
  • It has been tested in different devices running the same Android version.
  • App stops working in both background and activity displayed on screen.
  • It works again if I reinstall the application, but this is already included in ‘revoke and grant notification access again’ previously mentioned.
  • App includes AdMob banner on bottom, is it a possible problem?

I read Android has a cache problem or something like that. Is this the problem? Is there any permanent solution that I couldn’t find anywhere?