AndroidService, icon and text on notification bar

46 views
Skip to first unread message

Bonny

unread,
Jul 17, 2022, 3:51:47 PM7/17/22
to Py4A
Hello...

I try to make service to run in background. It works as should but I can't find way to change text and icon in notification panel. I want to show status here (OK / Alarm) and maybe even to change icon on notification bar.

I use kivy for job.
This is main.py:


from kivy.app import App
from kivy.uix.label import Label


class MyApp(App):
    def build(self):
        from android import AndroidService
        self.service = AndroidService('MyTitle', 'Mystate')
        self.service.start('Param to pass')
        return Label(text='Hello world')


if __name__ == '__main__':
    MyApp().run()

And this is service routine (main.py) in subfolder service.

import os
import time

print ("starting parameters: ",os.getenv('PYTHON_SERVICE_ARGUMENT'))
while True:
    print (time.time())
    time.sleep(10)

And in attached picture I mark what I mean to change.  Changes should be made from service routine but just can't find the way.Screenshot_1.pngScreenshot_2.png



Reply all
Reply to author
Forward
0 new messages