module Android::Commands

Public Instance Methods

adb_devices_l() click to toggle source

List of connected devices/emulators

# File lib/kraken-mobile/mobile/android_commands.rb, line 4
def adb_devices_l
  `adb devices -l`
end
create_file_with_name_in_device(device_id:, file_name:) click to toggle source
# File lib/kraken-mobile/mobile/android_commands.rb, line 18
def create_file_with_name_in_device(device_id:, file_name:)
  `adb -s #{device_id} shell "> /sdcard/#{file_name}"`
end
delete_file_with_name_in_device(device_id:, file_name:) click to toggle source
# File lib/kraken-mobile/mobile/android_commands.rb, line 22
def delete_file_with_name_in_device(device_id:, file_name:)
  `adb -s #{device_id} shell "rm -rf /sdcard/#{file_name}"`
end
device_orientation(device_id:) click to toggle source
# File lib/kraken-mobile/mobile/android_commands.rb, line 26
def device_orientation(device_id:)
  `adb -s #{device_id} shell dumpsys input | grep 'SurfaceOrientation' \
  | awk '{ print $2 }'`
end
file_content(device_id:, file_name:) click to toggle source
# File lib/kraken-mobile/mobile/android_commands.rb, line 8
def file_content(device_id:, file_name:)
  `adb -s #{device_id} shell "cat /sdcard/#{file_name} 2> /dev/null"`
end
save_snapshot_for_device_with_id_in_path(device_id:, file_path:) click to toggle source
# File lib/kraken-mobile/mobile/android_commands.rb, line 35
def save_snapshot_for_device_with_id_in_path(device_id:, file_path:)
  `adb -s #{device_id} shell cat /sdcard/window_dump.xml > #{file_path}`
end
screen_size_for_device_with_id(device_id:) click to toggle source
# File lib/kraken-mobile/mobile/android_commands.rb, line 31
def screen_size_for_device_with_id(device_id:)
  `adb -s #{device_id} shell wm size`
end
sdk_version_for_device_with_id(device_id:) click to toggle source
# File lib/kraken-mobile/mobile/android_commands.rb, line 39
def sdk_version_for_device_with_id(device_id:)
  `adb -s #{device_id} shell getprop ro.build.version.sdk`
end
write_content_to_file_with_name_in_device( content:, device_id:, file_name: ) click to toggle source
# File lib/kraken-mobile/mobile/android_commands.rb, line 12
def write_content_to_file_with_name_in_device(
  content:, device_id:, file_name:
)
  `adb -s #{device_id} shell "echo "#{content}" > /sdcard/#{file_name}"`
end