Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

4.3 notification support #19

Open
dattas opened this issue Oct 8, 2013 · 7 comments
Open

4.3 notification support #19

dattas opened this issue Oct 8, 2013 · 7 comments
Assignees
Milestone

Comments

@dattas
Copy link
Owner

dattas commented Oct 8, 2013

Android 4.3 has an api for handling notifications now. It would be great to detect android 4.3 and use the built in api instead of using the accessibility service.

@ghost ghost assigned dattas Oct 8, 2013
@mcrosson
Copy link

mcrosson commented Dec 3, 2013

I have created an initial, expirimental branch for using the 4.3 notification service classes instead of the accessibility service. Right now it just passes notifications and does not check to ensure the app is enabled in the notification service area of settings -> security.

https://github.com/mcrosson/pebble-notifier/tree/43_notification_service_exp

@mcrosson
Copy link

mcrosson commented Dec 4, 2013

I just finished getting the above branch working, the notification processing needs a little tweaking but I was able to pull the full text of the notification out.

One big issue that I ran into: NotificationListenerService classes do not run on the UI thread which causes the views.reapply call to crash. I had to create a processing thread that is run on the UI thread in order for this to work out properly.

@mcrosson
Copy link

mcrosson commented Dec 5, 2013

I did some further digging into this and discovered the following items that affect the code and approach. I've also been running my previously linked branch for >24 hours and all notifications have been received, processed and sent to my pebble without issue.

  • You cannot get a list of enabled notification service listeners from any of the public APIs. The necessary Settings.secure flag is private. This means there is no practical way to know if a given notification service listener is enabled and warn a user if it's not on.
  • There doesn't appear to be a clean way via code to not register an accessibility service if using a notification listener service.
  • LightFlow uses a notification service listener in 4.3+ and maintains an accessibility service that can be enabled. The dev is giving users a choice of which way to process notifications.
  • A notification service listener does not appear to have access to toast messages. Because of this the accessibility service likely needs to remain in order to not suffer feature regression when using a notification service listener to process notifications.
  • The code to process notifications can likely be refactored into a static utility class and called from an accessibility service or notification service listener.
  • A notification service listener approach does seem to work reliably and gives a straight forward way of clearing a given notification programmatically. This is most beneficial if a feature to clear notifications from a smart watch is developed.

@mcrosson
Copy link

mcrosson commented Dec 9, 2013

I made some real progress over the last few days with this set of changes. I have a generally working implementation at https://github.com/mcrosson/pebble-notifier/tree/notification_service_listener . There are some small bugs in the code, but overall it is working for the 4.3+ notification service listeners.

I plan to continue to improve the branch until it is 100% matched for the pre-existing code base.

@Daniel15
Copy link

@mcrosson Sounds great, thanks for your work! :D
Let us know when it's in a state ready for beta testing, I'm sure you'll have no trouble finding beta testers.

@salmander
Copy link

Any progress on this please?

@midi
Copy link

midi commented Feb 25, 2014

can you do a beta release over google play, or is it not ready at all?

thanks for your work!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants