Class: RMQDevice

Inherits:
Object show all
Defined in:
lib/project/ruby_motion_query/rmq_device.rb

Class Method Summary collapse

Class Method Details

.displayObject



30
31
32
# File 'lib/project/ruby_motion_query/rmq_device.rb', line 30

def display
  @display ||= RMQ.app.context.getSystemService(RMQ.app.context.WINDOW_SERVICE).defaultDisplay
end

.dpiObject



42
43
44
# File 'lib/project/ruby_motion_query/rmq_device.rb', line 42

def dpi
  #TODO
end

.heightObject



38
39
40
# File 'lib/project/ruby_motion_query/rmq_device.rb', line 38

def height
  @height ||= display.height
end

.os_code_nameObject



18
19
20
# File 'lib/project/ruby_motion_query/rmq_device.rb', line 18

def os_code_name
  @os_code_name ||= Android::Os::Build::VERSION.new.CODENAME
end

.os_versionObject



14
15
16
# File 'lib/project/ruby_motion_query/rmq_device.rb', line 14

def os_version
  @os_version ||= Android::Os::Build::VERSION.new.RELEASE.to_f
end

.sdk_at_least?(version) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/project/ruby_motion_query/rmq_device.rb', line 26

def sdk_at_least?(version)
  version.to_i <= sdk_version
end

.sdk_versionObject



22
23
24
# File 'lib/project/ruby_motion_query/rmq_device.rb', line 22

def sdk_version
  @sdk_version ||= Android::Os::Build::VERSION.new.SDK_INT
end

.unique_idObject



46
47
48
49
50
# File 'lib/project/ruby_motion_query/rmq_device.rb', line 46

def unique_id
  # This is no simple task... and can sometimes be nil based on device implementation
  # This does seem, however, to be the best answer for now.
  Android::Provider::Settings::Secure.getString(find.app.getContentResolver, "android_id")
end

.widthObject



34
35
36
# File 'lib/project/ruby_motion_query/rmq_device.rb', line 34

def width
  @width ||= display.width
end