pilot51 / voicenotify

Android app that speaks notifications
https://voicenotify.app
Apache License 2.0
157 stars 55 forks source link

Fully read Jellybean extended notifications #5

Closed prodrigestivill closed 6 years ago

prodrigestivill commented 11 years ago

Jellybean support long notifications text, it will be great if Voice Notify could read the extended text of this notifications.

pilot51 commented 11 years ago

Thank you for the suggestion. I'm not sure if that's possible with Accessibility, but I've noted it just in case.

pilot51 commented 10 years ago

I found a way to read extended notification text! It's kind of a hackish method that involves inflating and scanning through the views that make up the extended notification. I'm not sure how well I can make it work for some of the more dynamic extended notifications, but I expect to have basic support in the next feature release.

spyps commented 10 years ago

@pilot51 Thank you for your quick reply. I notice that there is another app called "SpeakMe" on Play Store, the Pro version of which can read the extended notification without any issue on my phone (Moto X running Kitkat 4.4.2). Sadly it's not an open source app. I will switch back to Voice Notify once it can read the extended notification.

prodrigestivill commented 10 years ago

Hi, I was thinking more like using the new Jellybean API for that matter. I think its called NotificationListenerService https://developer.android.com/reference/android/service/notification/NotificationListenerService.html and it permits an app to get all notifications without using the Accessibility API at all.

spyps commented 10 years ago

@prodrigestivill According to the introdution of the API I think it would be great if Voicenotify could use it. The "dismissal of a single notification" function would be great, since I like the feature to automatically remove a notification after it has been spoken. However, the problem is that this API seems to be introduced since Anroid 4.3 (according to this: http://www.kpbird.com/2013/07/android-notificationlistenerservice.html), and currently only about 10% android devices in total running 4.3 and 4.4. So a lot of device can't use this api to speak the extended notification.

I'm sorry that I am not a developer and know little about programming, so I can't discuss in detail.

pilot51 commented 10 years ago

I looked into the NotificationListenerService and it doesn't really provide much more than is already passed through Accessibility. They both pass a Notification object (as a Parcelable for Accessibility), which contains the views for the extended notification. I don't see any other way to get the data. As mentioned, it appears that one benefit of NLS is to dismiss 3rd party notifications. Since 4.3+ is less than 20% of the current install base and I don't think the time vs. benefit is worth it at this point, I'm going to hold off on implementing NLS.

spyps commented 10 years ago

Yesterday I found there is a paid plugin AutoNotifications for Tasker in the Playstore. The plugin is only for Android 4.3+ and can read the expanded message through NLS (built-in function of Tasker can only read the title of notification). Now I am using two profiles in Tasker to read the notification aloud. One profile will intercept every notification and save it in a queue, then dismiss the notification in the system notification bar. Another profile checks if the queue is empty and reads the notification if there' s any. It's working great on my phone currently. @prodrigestivill if you are running Android 4.3+ you can try Tasker.

pilot51 commented 6 years ago

Apparently I didn't see the notification data passed through extras in my last comment. Anyway, this has been resolved in the commit above.