Class: AppDelegate

Inherits:
Object
  • Object
show all
Defined in:
app/app_delegate.rb

Instance Method Summary collapse

Instance Method Details

#application(application, didFinishLaunchingWithOptions: launchOptions) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/app_delegate.rb', line 4

def application(application, didFinishLaunchingWithOptions:launchOptions)

  after 2.sec do

    @beaconManager = BeaconManager.new('E2C56DB5-DFFB-48D2-B060-D0F5A71096E0', 'com.codium.iBeaconsDemo')

    @beaconManager.createRegion(major: 0, minor: 1)
    @beaconManager.startRangingBeacons(major: 0, minor: 1)
    @beaconManager.createRegion(major: 0, minor: 2)
    @beaconManager.startRangingBeacons(major: 0, minor: 2)

    @beaconManager.onEnterRegion { |region|

      NSLog("Region entered: #{region.to_s}")
    }

    @beaconManager.onLeaveRegion { |region|
      NSLog("Region leaved: " + region.to_s)
    }

    @beaconManager.onChangeRegion { |oldRegion, newRegion|
      NSLog("Region change, old: [#{oldRegion.to_s}] new: [#{newRegion}]")
    }

    @beaconManager.onLostRegions {
      NSLog("Regions lost")
    }

  end

  true
end