module Platform::Android::Device

Public Instance Methods

start_android_device() click to toggle source
# 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_device() click to toggle source
# File lib/mobmanager/mobile/platform/android/device.rb, line 37
def terminate_android_device
  system 'adb kill-server'
end
wait_for_android_device() click to toggle source
# 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