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.
This commit is contained in:
Goffi 2021-09-08 11:17:13 +02:00
commit 47d258e841

View file

@ -309,9 +309,11 @@ class AndroidPlugin(object):
# "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