Class: DeviceAPI::Android::Kindle

Inherits:
Device
  • Object
show all
Defined in:
lib/device_api/android/device/kindle.rb

Overview

Kindle specific device class

Instance Attribute Summary

Attributes inherited from Device

#qualifier

Instance Method Summary collapse

Methods inherited from Device

#app_version_number, #battery, #battery_info, #battery_level, #block_package, #connect, create, #device, #disconnect, #diskstat, #display_name, #dpi, #imei, inherited, #initialize, #install, #intent, #ip_address, #is_connected?, #is_remote?, #list_installed_packages, #manufacturer, #memory, #model, #monkey, #orientation, #package_name, #powered?, #range, #reboot, #resolution, #screen_on?, #screenshot, #serial_no, #set_ip_and_port, #status, #type, #uninstall, #uptime, #version, #wifi_mac_address, #wifi_status

Constructor Details

This class inherits a constructor from DeviceAPI::Android::Device

Instance Method Details

#swipe_coordsObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/device_api/android/device/kindle.rb', line 13

def swipe_coords
  res = resolution
  x = res[1].to_i
  y = res[2].to_i
  if version.split('.').first.to_i < 5
    {x_from: x - 100, y_from: y/2, x_to: x/6, y_to: y/2}
  else
    { x_from: x/2, y_from: y -100, x_to: x/2, y_to: y/6}
  end
end

#unlockObject

On non-Kindle devices, if a device is locked without a password (i.e. ‘Swipe to unlock’), then you can unlock that device by broadcasting a ‘WakeUp’ intent. On Kindle devices, this does not work due to Amazons implementation of the Keyguard.



8
9
10
11
# File 'lib/device_api/android/device/kindle.rb', line 8

def unlock
  ADB.keyevent(qualifier, '26') unless screen_on?
  ADB.swipe(qualifier, swipe_coords)
end