-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Service notification #2703
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @RobertFlatt !
Thank you for such a feature! I've added a couple of comments, please let me know what do you think about it 😀
pythonforandroid/bootstraps/common/build/templates/Service.tmpl.java
Outdated
Show resolved
Hide resolved
pythonforandroid/bootstraps/service_library/build/templates/Service.tmpl.java
Outdated
Show resolved
Hide resolved
Hey @misl6 , this work for you? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you!
* add_resources * add_resource * Update build.py * stateless * multiple kinds * pep8 * --add_resource * Custom notification * Update Service.tmpl.java * Custom Notification * Custom Notification * service notification * customize notification * share code * share code * Update Service.tmpl.java
An Android Service, when started, displays a service icon (in the task bar) and a notification message (in the notification shade history).
For a p4a app the icon and notification are not user configurable. The service icon is some sub region of the app launch icon, and the notification content is the service name. I characterize this as proof-of-concept functionality.
This PR overloads the service
start()
method with a new method having 3 extra string parameters: 'icon resource name', 'notification title', and 'notification text'. The PR applies these extra parameters, and separately we make notification channel names unique. Changes occur in the common, service_only, and service_library bootstraps.A test case may be found here https://github.com/RobertFlatt/service_icon_test
As a side note the current p4a service implementation depends on a depreciated api, have added a comment to identify this.