Coder Social home page Coder Social logo

ios-indoorlocation-sdk's Introduction

Ubudu Indoor Location SDK for iOS

The Indoor location SDK provides a solution that allows mobile devices to estimate their position within an indoor venue. The position is computed in real time based on the beacons placed inside the venue and from which the device receives signal broadcasts.

The solution allows users to create their maps on the Ubudu manager platform. A map is attached to a particular venue previously created in the manager. Then various entities can be defined and positioned on the map:

Beacons

This is the most important part. Correctly positioning the beacons on the map, and then deploying them accordingly in the venue, is the key to perform accurate indoor positioning. User has to place beacons on the map in a way that the entire surface where indoor location should work is covered. To achieve best positioning precision at least four beacons should always be on the line of sight of the mobile device and sufficiently close from it.

Map zones

Zones are rectangular areas positioned on the map. They are useful to define zones of interest for which we would like to detect presence or distance. The mobile device can access all the zones defined of a given map through the SDK API and also retrieve the currently closest zone, or compute the distance to any zone.

Non-navigable areas

These areas inside a venue indicarte the zones inaccessible to people. They can be defined when editing a map. You should mark all the walls and/or big obstacles that are inaccessible to people and so in which the mobile device cannot be, and through which it cannot "cross instantly" as well (an obstacle needs to be walked around to go from one side to another). Defining those non-navigable zones lets the indoor location SDK achieve better accuracy and will provide a better experience.

System and hardware requirements

  • iOS 7.0 or higher.
  • iPhone 4S / iPad 3rd generation / iPad mini / iPod touch 5th generation, or any more recent device.

I. Adding the Ubudu SDK to a project.

Using CocoaPods

This is the prefered and simplest way to get started. Just add the following line to your Podfile:

pod 'UbuduIndoorLocation'

and execute pod install

If you are not already using CocoaPods for your project you can get started by reading the CocoaPods documentation.

Manually

If you don't want or cannot use CocoaPods you can install the SDK manually by following the instructions bellow.

  1. Drag & drop the UbuduIndoorLocation.framework folder into the Frameworks folder of your project in XCode. Check the "Copy items into destination group's folder (if needed)" option.

  2. Add the following list of frameworks and libraries to your project if they are not already present. (dont forget libc++.dylib !)

    • Foundation
    • CoreGraphics
    • UIKit
    • CoreLocation
    • libc++.dylib

    Your framework folder should look like this:

    illustration_frameworkfolder

    [Instructions](https://developer.apple.com/library/ios/recipes/xcode_help-project_editor/Articles/ AddingaLibrarytoaTarget.html#//apple_ref/doc/uid/TP40010155-CH17) on how to add an Apple framework to your project.

  3. In the project settings go to: "General"->"Your Target"->"Build Settings"->"(All)"->"Other Linker Flags" and add the following flags: -ObjC

II. Project configuration

Location authorization (required)

Since iOS 8.0 it is required to add an entry to the Info.plist file that indicates wich location authorization is required by your app:

  • To use the "Always" mode add the NSLocationAlwaysUsageDescription key.
  • To use the "When In Use" mode then add the NSLocationWhenInUseUsageDescription key.

The Indoor Location SDK can work with both mode as it based on iBeacon ranging, which is basically a foreground only feature.

illustration_entry

You also need to call the corresponding CoreLocation method before starting the Ubudu Indoor Location manager.

  • When In Use mode: [[[CLLocationManager alloc] init] requestWhenInUseAuthorization];
  • Always mode: [[[CLLocationManager alloc] init] requestAlwaysAuthorization];

See Apple CoreLocation documentation for more details.

III. Setup the Indoor Location SDK

First of all you need a configured map. To create and configure a map go on the ubudu Manager

  • Select a venue into Venues & indoor maps.
  • Click on the Maps button and click Add.

Then once the map properties are configured, the manager provide you the unique key of the map.

  • Import the header in your view controller #import <UbuduIndoorLocation/UbuduIndoorLocation.h>
  • Instanciate an UBUIndoorLocationManager object.
  • Load your map using the method loadMapWithKey:success:failure:
  • Implement the protocol UBUIndoorLocationManagerDelegate in your view controller.
  • Finally call start on your indoor position manager to start receiving position updates.

A stop method exists as well, don't forget to call it when you don't need the position inside the venue anymore.

Here is an example on how to initialize and start the SDK:

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self initIndoorLocationManager];
}

- (void)initIndoorLocationManager
{
	NSString *mapKey = @"1eff16a0d6c80132a0ef0a824b34cee9";
	
	self.locationManager = [[UBUIndoorLocationManager alloc] init];
    self.locationManager.delegate = self;

	[self.locationManager loadMapWithKey:mapKey success:^{
        NSLog(@"Map loading success");
        [self.locationManager start]; // start only on success callback
        
    } failure:^(NSError *error) {
        NSLog(@"Map loading failure: %@", error);
    }];
}

IV. Location Manager delegate

The UBUIndoorLocationManagerDelegate provides callback methods which you can implement to receive events from the indoor location manager.

Implement any of the methods below to receive events that are of any interest for your application:

- (void)locationManager:(UBUIndoorLocationManager *)locationManager didUpdateBeacons:(NSArray *)beaconsUpdates; 

- (void)locationManager:(UBUIndoorLocationManager *)locationManager positionDidChange:(UBUPositionUpdate *)positionUpdate;

- (void)locationManager:(UBUIndoorLocationManager *)locationManager closestNavigablePointDidChange:(UBUPositionUpdate *)positionUpdate;

- (void)locationManager:(UBUIndoorLocationManager *)locationManager closestBeaconDidChange:(UBUPositionUpdate *)positionUpdate;

- (void)locationManager:(UBUIndoorLocationManager *)locationManager closestZoneDidChange:(UBUPositionUpdate *)positionUpdate;

V. Map Rendering

The Ubudu Indoor Location SDK provides a simple view controller that can display a map, the zones you defined and your position on the map.

On your header file you can declare @class UBUMapViewController;

And a property : @property(strong, nonatomic) UBUMapViewController * mapViewController;

Based on the previous code snippet (cf : III Setup the Indoor Location SDK), here is an example of how to display the map view controller.

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self initIndoorLocationManager];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    // Subscribe as delegate everytime we appear because mapViewController sets itself as location manager delegate when presented
    self.locationManager.delegate = self;
}

- (void)initIndoorLocationManager
{
	NSString *mapKey = @"1eff16a0d6c80132a0ef0a824b34cee9";
	
	self.locationManager = [[UBUIndoorLocationManager alloc] init];
	 [self.locationManager loadMapWithKey:mapKey success:^{
        NSLog(@"Map loading success");
        [self.locationManager start];
        
        // Push the map view conroller once the map is loaded
		[self showMap];
    } failure:^(NSError *error) {
        NSLog(@"Map loading failure: %@", error);
    }];
}

- (void)showMap
{
    self.mapViewController = [[UBUMapViewController alloc] init];
    self.mapViewController.locationManager = self.locationManager;
    [self presentViewController:self.mapViewController animated:YES completion:NULL];
}

ios-indoorlocation-sdk's People

Contributors

zioolek avatar fkruta avatar woildan avatar

Stargazers

Vasco Yiu avatar  avatar  avatar

Watchers

 avatar James Cloos avatar Piotr avatar Thomas Saphir avatar  avatar

ios-indoorlocation-sdk's Issues

Upload image not display

Hello team ,
indoor map not display in demo app

[self.locationManager loadApplicationForNamespace:namespace
downloadImages:YES
success:^{
NSLog(@"We've loaded application for namespace: %@", namespace);

                                              NSError *error = nil;
                                              BOOL started = [_locationManager start:&error];
                                              if (error == nil && started == YES) {
                                                  
                                                  NSString *template = @"https://imagesd.ubudu.com/u_maps_tiles/87444/9903848c8e9299a6d851adedd626988d/{z}/{x}/{y}.png";
                                                  MKTileOverlay *overLay = [[MKTileOverlay alloc] initWithURLTemplate:template];
                                                  overLay.canReplaceMapContent = YES;
                                                  
                                                  [self.mapView addOverlay:overLay level:MKOverlayLevelAboveLabels];
                                                  [self.mapView setRegion:MKCoordinateRegionMake(CLLocationCoordinate2DMake(23.0269, 72.5241), MKCoordinateSpanMake(0.25, 0.25))];
                                                  
                                                
                                                  NSLog(@"location manager started %@",_locationManager.mapOverlayForCurrentMap);
                                                  
                                                  
                                              }
                                              else { NSLog(@"error while starting IL manager: %@", error); }
                                              
                                          } failure:^(NSError *error) {
                                              NSLog(@"Error while loading application for namespace: %@", error.localizedDescription);
                                          }];

}

[self.locationManager loadApplicationForNamespace:namespace
downloadImages:YES

Map image not display

New created map is unable to load

Hi Jean Felix TRAN,
How are you?

I have create a new venue from your (https://manager.ubudu.com/) ubudu manager.For testing purpose i have added a map as per your given instruction. I get the new map key when i successfully create a map.
I'm using your demo application and i replaced the map keys, but unfortunately new added map is not able to view in UBUMapViewController and your already given map is working fine.

"NSString *mapKey = mapKeys;
[self.locationManager loadMapWithKey:mapKey success:^{
NSLog(@"Map loading success");

    [self.locationManager start];
    [self.showMapButton setEnabled:YES];

} failure:^(NSError *error) {
    NSLog(@"Map loading failure: %@", error);

    [self displayError:error];
    [self.showMapButton setEnabled:NO];
}];

"
In log i always getting "Map loading success".
Your help can be appreciated.

Best Regards,
Akhtar

Upload image not display iOS

Hi, I have an issue with the demo that is published for inddorlocation.

The Demo version Ubudu / IOS-IndoorLocation-SDK not view the image configurate at console

NSString *namespace = @"2922b5a5da2ee43a943b74e3620ccbc8f8872d5c";

self.locationManager = [UBUIndoorLocationManager sharedInstance];
self.locationManager.delegate = self;

UBUIndoorLocationConfiguration *ilConfig = [[UBUIndoorLocationConfiguration alloc] initWithAppNamespace:namespace];
ilConfig.motionFiltering = YES;
ilConfig.updateHeading = YES;
ilConfig.localizationMode = kBLEMode;

self.locationManager.configuration = ilConfig;
[self.locationManager startWithCompletionBlock:^(NSError *error) {
if(error != nil) {
NSLog(@"Error while loading application for namespace: %@", error.localizedDescription);
return;
}
NSLog(@"location manager started");
}];

And the version example of version v2.7.0

Tampoco muestra la imagen configurada.
self.locationManager = [UBUIndoorLocationManager sharedInstance];
self.locationManager.delegate = self;
self.locationManager.motionFiltering = YES;
self.locationManager.updateHeading = YES;

           [self.locationManager loadApplicationForNamespace:namespace
                               downloadImages:YES
                                      success:^{
                                          NSLog(@"We've loaded application for namespace: %@", namespace);
                                          
                                          NSError *error = nil;
                                          BOOL started = [_locationManager start:&error];
                                          if (error == nil && started == YES) { NSLog(@"location manager started"); }
                                          else { NSLog(@"error while starting IL manager: %@", error); }
                                          
                                      } failure:^(NSError *error) {
                                          NSLog(@"Error while loading application for namespace: %@", error.localizedDescription);
                                      }];

When run first not show the image map.

And next run every crashing

Assertion failure in -[CLLocationManager startRangingBeaconsInRegion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/CoreLocationFramework/CoreLocation-2245.0.41/Framework/CoreLocation/CLLocationManager.m:1283

as a note, on Android with the same key show the image map and iOS do not show the image map

My key is 2922b5a5da2ee43a943b74e3620ccbc8f8872d5c.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.