Module: Platform::Android::Device

Includes:
OS
Included in:
Common
Defined in:
lib/mobmanager/mobile/platform/android/device.rb

Instance Method Summary collapse

Methods included from OS

#mac?

Instance Method Details

#start_android_deviceObject



11
12
13
14
15
# File 'lib/mobmanager/mobile/platform/android/device.rb', line 11

def start_android_device
  puts "Setting android device #{ANDROID_DEVICE}"
  system 'adb start-server'
  wait_for_android_device
end

#terminate_android_deviceObject



37
38
39
# File 'lib/mobmanager/mobile/platform/android/device.rb', line 37

def terminate_android_device
  system 'adb kill-server'
end

#wait_for_android_deviceObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/mobmanager/mobile/platform/android/device.rb', line 17

def wait_for_android_device
  max_wait = 5
  counter = 0

  found = false
  while !found && counter <= max_wait
    devices = %x[adb devices]
    list = list_of_devices(devices)
    begin
      found = is_partial_string_in_array?(ANDROID_DEVICE, list)
    rescue Exception => e
      found = false
    end
    if found
      return puts "Android device #{ANDROID_DEVICE} found."
    end
    counter += 1
  end
end