Mercurial > libervia-backend
diff sat/plugins/plugin_misc_android.py @ 3654:3910ad643e9d
plugin android: use `callFromThread` instead of `callLater`:
`callLater` is not made to be called outside of main thread, `callFromThread` is the
method to call in this case.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 08 Sep 2021 11:17:13 +0200 |
parents | 7550ae9cfbac |
children | 524856bd7b19 |
line wrap: on
line diff
--- a/sat/plugins/plugin_misc_android.py Wed Sep 08 11:17:04 2021 +0200 +++ b/sat/plugins/plugin_misc_android.py Wed Sep 08 11:17:13 2021 +0200 @@ -309,9 +309,11 @@ # "XXX has no attribute 'invoke'" error (looks like the same issue as # https://github.com/kivy/pyjnius/issues/59) self.br = BroadcastReceiver( - callback=lambda *args, **kwargs: reactor.callLater(0, - self.onConnectivityChange), - actions=["android.net.conn.CONNECTIVITY_CHANGE"]) + callback=lambda *args, **kwargs: reactor.callFromThread( + self.onConnectivityChange + ), + actions=["android.net.conn.CONNECTIVITY_CHANGE"] + ) self.br.start() @property