comparison service/main.py @ 369:bbf992b0be0d

android (service): set autorestart: with this option, the backend will automatically restart as soon as terminated. This is notably important at the moment to work around a P4A bug which result in a backend killed when frontend is closed (cf. https://github.com/kivy/python-for-android/issues/2053)
author Goffi <goffi@goffi.org>
date Mon, 27 Jan 2020 21:17:08 +0100
parents 38d763febed6
children 203755bbe0fe
comparison
equal deleted inserted replaced
368:7fd138c12506 369:bbf992b0be0d
1 #!/usr//bin/env python2 1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 2
4 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client 3 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client
5 # Copyright (C) 2016-2018 Jérôme Poisson (goffi@goffi.org) 4 # Copyright (C) 2016-2018 Jérôme Poisson (goffi@goffi.org)
6 5
7 # This program is free software: you can redistribute it and/or modify 6 # This program is free software: you can redistribute it and/or modify
35 sys.platform = "android" 34 sys.platform = "android"
36 C.PLUGIN_EXT = "pyc" 35 C.PLUGIN_EXT = "pyc"
37 from sat.core import sat_main 36 from sat.core import sat_main
38 from twisted.internet import reactor 37 from twisted.internet import reactor
39 from twisted.application import app, service 38 from twisted.application import app, service
39 from jnius import autoclass
40
41
42 PythonService = autoclass('org.kivy.android.PythonService')
43 PythonService.mService.setAutoRestartService(True)
44
40 45
41 sat = sat_main.SAT() 46 sat = sat_main.SAT()
42 application = service.Application("SàT backend") 47 application = service.Application("SàT backend")
43 sat.setServiceParent(application) 48 sat.setServiceParent(application)
44 app.startApplication(application, None) 49 app.startApplication(application, None)