code: def has_permission(self, permission):
          
          f = self.create_future()
  
          #: Old versions of android did permissions at install time
          if self.api_level < 23:
              f.set_result(True)
              return f
  
          def on_result(allowed):
              result = allowed == Activity.PERMISSION_GRANTED
              self.set_future_result(f, result)
  
          self.widget.checkSelfPermission(permission).then(on_result)
  
          return f
docs: Return a future that resolves with the result of the permission