Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
898 views
in Technique[技术] by (71.8m points)

service - Best way to control NotificationListenerService via Android app UI

What's the best way to control an Android service from an app (and app UI)?

For personal use, I'm writing a class that overrides NotificationListenerService and performs some customization of notifications before they're displayed.

So far I've been able to build a basic app that displays a UI and also starts an overridden NotificationListenerService. It works ok.

I'd like to be able to at least enable and disable that NotificationListenerService, though, via the UI. And ideally I'd like to be able to enter other data (like a start and end time for the notification changes, perhaps, or some customizations for which apps have their notifications modified) in that UI as well, and then have the overridden NotificationListenerService work using those values.

Within the Android ecosystem, what's the best way to have the app/UI and the service communicate in order to achieve that? Right now even if I close that UI, the service keeps running (which is great... but to disable or end it I'll need to reach it somehow).

Sorry if the question is strange or seems basic - this is my first Android app and I'm basically writing it because I need this functionality, so many aspects of app design/structure are new to me.

question from:https://stackoverflow.com/questions/65642097/best-way-to-control-notificationlistenerservice-via-android-app-ui

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...