code: def on_activity_lifecycle_changed(self, change):
          
          d = self.declaration
          if d.active:
              if change['value'] == 'paused':
                  self.widget.pause(now=True)
              elif change['value'] == 'resumed':
                  self.widget.resume()
docs: If the app pauses without pausing the barcode scanner
              the camera can't be reopened. So we must do it here.