Module: Appium::Core::Device::AppState

Defined in:
lib/appium_lib_core/device/app_state.rb

Constant Summary collapse

STATUS =
[
  :not_installed,                   # 0
  :not_running,                     # 1
  :running_in_background_suspended, # 2
  :running_in_background,           # 3
  :running_in_foreground            # 4
].freeze

Class Method Summary collapse

Class Method Details

.add_methodsObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/appium_lib_core/device/app_state.rb', line 13

def self.add_methods
  ::Appium::Core::Device.add_endpoint_method(:app_state) do
    def app_state(app_id)
      # required: [['appId'], ['bundleId']]
      response = execute :app_state, {}, appId: app_id

      case response
      when 0, 1, 2, 3, 4
        ::Appium::Core::Device::AppState::STATUS[response]
      else
        ::Appium::Logger.debug("Unexpected status in app_state: #{response}")
        response
      end
    end
  end
end