CLBeacon – how to change rssi, major and minor?
My question is basically – how do I get to modify iBeacon’s default settings like major, minor and RSSI?
2 Solutions Collect From Internet About “CLBeacon – how to change rssi, major and minor?”
There are different ways to set these values depending on what you mean by an iBeacon:
Each Beacon vendor has different ways of setting these values. Some are changed via a bluetooth service that is typically managed with a proprietary iOS or Android app. (Examples include Radius Networks’ battery-powered and USB beacons and TwoCanoes beacons.) Radius Networks’ PiBeacon includes an SD card with an editable file containing the identifiers. Other vendors like Estimote create beacons with fixed UUIDs that cannot be changed. Because there is no standard mechanism, there is no universal tool for setting identifiers on all beacon types.
iOS Software iBeacons:
You set these values with code like below:
CLBeaconRegion *region = [[CLBeaconRegion alloc] initWithProximityUUID:[[NSUUID alloc] initWithUUIDString:@"2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6"] major:1 minor:1 identifier:@"com.radiusnetworks.iBeaconExample"]; NSDictionary *peripheralData = [region peripheralDataWithMeasuredPower:-55]; [_peripheralManager startAdvertising:peripheralData];
CLBeaconclass is not designed to be created or modified by the user — it is supposed to be constructed by
CoreLocationwhen it detects iBeacons. That said, you can force writing to its read-only properties using KVO syntax like so:
CLBeacon * iBeacon = [[CLBeacon alloc] init]; [iBeacon setValue:[NSNumber numberWithInt:1] forKey:@"major"]; [iBeacon setValue:[NSNumber numberWithInt:1] forKey:@"minor"]; [iBeacon setValue:[NSNumber numberWithInt:-55] forKey:@"rssi"]; [iBeacon setValue:[[NSUUID alloc] initWithUUIDString:@"2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6"] forKey:@"proximityUUID"]; NSLog(@"I constructed this iBeacon manually: %@", iBeacon);
However, if you are forcing the
CLBeaconclass to be used in ways it was not designed to be used that might mean you are doing something wrong.
Full disclosure: I work for Radius Networks.
When you initialize a CLBeaconRegion object you can specify Major and Minor variables. Took a look at initWithProximityUUID:major:minor:identifier method.
As far as am aware ones a beacon active your cannot change it value unless you recreate that object. Rssi represents signal strength of the beacon which is only read-only and depends on the environment.
Here the link for the (documentation](https://developer.apple.com/library/iOs/documentation/CoreLocation/Reference/CLBeaconRegion_class/Reference/Reference.html#//apple_ref/doc/uid/TP40013054)
- How would I store a video into firebase storage from swift?
- Instantiating split view controller by identifier in OS X storyboard does not load view hierarchy
- The file *.storyboardc was not found
- importing swift framework into a objective-c project
- Inline if statement mutating inout parameter in a void return closure, weird error (Error: type 'Int1' does not conform to protocol 'BooleanType')
- NSThread sleepfortimeinterval blocks main thread
- What do “Dirty” and “Resident” mean in relation to Virtual Memory?
- How to build IPA for distribution with TestFlight with XCode 5?
- SpriteKit: Why does it wait one round for the score to update? (Swift)
- iOS 7 UIDatePicker height inconsistency?
- iOS 9 CoreData / ICloud – No such document at URL
- How do I launch a new view right after a purchase is made and how can I make this view the new view at App Launch?
- Basic array comparison algorithm
- AVFoundation tap to focus feedback rectangle
- An App ID with Identifier 'com.example.app.extention' is not available. Please enter a different string