SimenCodes / heads-up

Heads-up notifications - Get the new heads-up notifications from Android Lollipop on any device, for free!
http://simen.codes/app/android-5-headsup-notifications/
GNU General Public License v3.0
178 stars 60 forks source link

How to connect to NotificationListenerService properly? #132

Closed Chuque closed 6 years ago

Chuque commented 6 years ago

Hi SimenCodes, I don't know exaclty if this is the place for developers asking for help, but I have one question. I analysed the code but I didn't understand how to connect to the NotificationListenerService and use its methods, like getActiveNotifications() or cancelNotification(). I am starting a project similar to yours and I am stuck. I extended NLService but I cannot get a reference to it. Your code is a little bit complex for me. So what is the point? What is the simplest and correct way to retrieve those StatusBarNotifications?

SimenCodes commented 6 years ago

Hi! The notification listener service must be registered in the manifest with a special permission. You cannot start it directly, it is started by Android when the user grants permission to read notifications. Hope this helps you in the right direction, and good luck with your project :)