comparison sat/plugins/plugin_misc_android.py @ 3018:758bee45612b

plugin android: catch and log exception when using the vibrator: vibrator is currently not working with plyer, this patch avoid a crash and log the issue. rel 332
author Goffi <goffi@goffi.org>
date Sat, 20 Jul 2019 20:53:52 +0200
parents 9aadf11b315b
children ab2696e34d29
comparison
equal deleted inserted replaced
3017:e7cbe662838b 3018:758bee45612b
241 241
242 notification.notify(title=subject, message=message) 242 notification.notify(title=subject, message=message)
243 if self.host.memory.getParamA( 243 if self.host.memory.getParamA(
244 PARAM_VIBRATE_NAME, PARAM_VIBRATE_CATEGORY, profile_key=client.profile 244 PARAM_VIBRATE_NAME, PARAM_VIBRATE_CATEGORY, profile_key=client.profile
245 ): 245 ):
246 vibrator.vibrate() 246 try:
247 vibrator.vibrate()
248 except Exception as e:
249 # FIXME: vibrator is currently not working,
250 # cf. https://github.com/kivy/plyer/issues/509
251 log.warning(u"Can't use vibrator: {e}".format(e=e))
247 return mess_data 252 return mess_data
248 253
249 def messageReceivedTrigger(self, client, message_elt, post_treat): 254 def messageReceivedTrigger(self, client, message_elt, post_treat):
250 if not self.cagou_active: 255 if not self.cagou_active:
251 # we only send notification is the frontend is not displayed 256 # we only send notification is the frontend is not displayed