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

Includes:
_Bridge
Included in:
Bridge
Defined in:
lib/appium_lib_core/common/device/app_state.rb,
sig/lib/appium_lib_core/common/device/app_state.rbs

Constant Summary collapse

STATUS =

Returns:

  • (::Array[:not_installed | :not_running | :running_in_background_suspended | :running_in_background | :running_in_foreground])
[
  :not_installed,                   # 0
  :not_running,                     # 1
  :running_in_background_suspended, # 2
  :running_in_background,           # 3
  :running_in_foreground            # 4
].freeze

Instance Method Summary collapse

Methods included from _Bridge

#bridge, #execute, #execute_async_script, #execute_script

Instance Method Details

#app_state(app_id) ⇒ Object

Parameters:

  • app_id (Object)

Returns:

  • (Object)


28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/appium_lib_core/common/device/app_state.rb', line 28

def app_state(app_id)
  # appId is for android, bundleId is for ios.
  response = execute_script 'mobile:queryAppState', { 'appId': app_id, 'bundleId': app_id }

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