Class: SensoroBeaconManager

Inherits:
Object
  • Object
show all
Defined in:
lib/ios/sensoro_beacon_manager.rb,
lib/android/sensoro_beacon_manager.rb

Class Method Summary collapse

Class Method Details

._sensoroManagerObject



45
46
47
# File 'lib/android/sensoro_beacon_manager.rb', line 45

def self._sensoroManager
  @sensoroManager or raise "Set `#{self}.context = self' in your main activity file."
end

.context=(context) ⇒ Object



41
42
43
# File 'lib/android/sensoro_beacon_manager.rb', line 41

def self.context=(context)
  @sensoroManager = Com::Sensoro::Cloud::SensoroManager.getInstance(context)
end

.enabled?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/ios/sensoro_beacon_manager.rb', line 40

def self.enabled?
  true # TODO
end

.start_listening(&callback) ⇒ Object



44
45
46
47
48
49
50
51
52
# File 'lib/ios/sensoro_beacon_manager.rb', line 44

def self.start_listening(&callback)
  @listener ||= begin
    listener = SensoroBeaconManagerListener.new(callback)
    SBKBeaconManager.sharedInstance.requestAlwaysAuthorization
    SBKBeaconManager.sharedInstance.delegate = listener
    SBKBeaconManager.sharedInstance.startRangingBeaconsWithID(SBKBeaconID.beaconIDWithProximityUUID(SBKSensoroDefaultProximityUUID), wakeUpApplication:true)
    listener
  end
end

.stop_listeningObject



54
55
56
57
# File 'lib/ios/sensoro_beacon_manager.rb', line 54

def self.stop_listening
  SBKBeaconManager.sharedInstance.stopRangingAllBeacons
  SBKBeaconManager.sharedInstance.delegate = @listener = nil
end