NotificationListenerService not working - even after giving permission

前端 未结 2 839
小蘑菇
小蘑菇 2021-01-18 02:16

Below is my code to capture notifications. I dont understand why the onNotificationPosted is not getting fired.

I am giving my app Notifications acc

相关标签:
2条回答
  • 2021-01-18 02:36

    It does seem to be a bit flakey, but this is the actual fix in this case:

    @Override
    public IBinder onBind(Intent intent) {
        return super.onBind(intent);
    }
    
    0 讨论(0)
  • 2021-01-18 02:45

    I've been trying to get it working for the second day, and I succeeded. Try adding these lines at the end of onStartCommand method.

    And, it hardly plays a role, but try to declare your service after activities in the manifest file.

    This comment with sample code was really helpful to me: https://stackoverflow.com/a/41521664/10652152

    0 讨论(0)
提交回复
热议问题