NAV Navbar
objc
  • Introduction
  • Prerequisites
  • Quick Start
  • Access
  • Authentication
  • Providing Heading
  • Delegate
  • Object Management
  • Introduction

    Welcome to the Proximi.io Map iOS SDK reference. Use our library to hook into the new Proximi.io platform.

    While this is only the iOS explanation, you can also find our Android reference here. You can view code examples in the dark area to the right.

    This API documentation page was created with Slate.

    Prerequisites

    Prior to using the Proximi.io Map features you will have to complete the following quick steps:

    Quick Start

    
    //  OBJECTIVE-C CODE EXAMPLE
    
    //Apply the delegate
    @interface MAStorage : UIViewController <ProximiioDelegate, ProximiioMapDelegate>
    {
    
    }
    
    //Implement the functions you want to use
    
    // if proximiioHandlePushMessage method is not implemented in your delegate, Proximiio SDK will handle the push message automatically
    - (BOOL)proximiioHandlePushMessage:(NSString*)title {
    NSLog(@"Received new push message: %@", title);
    return YES;
    }
    
    //Update the position on the map and center it around it
    - (void)proximiioPositionUpdated:(ProximiioLocation*)location {
    [_mapView setUserLocation:location];
    [_mapView setCenter:location.coordinate zoomLevel:22 animated:YES];
    }
    
    // call requestPermission if you want to handle location permission by Proximio.io SDK
    - (void)onProximiioReady {
    [[Proximiio sharedInstance] enable]; // start scanning
    [[Proximiio sharedInstance] requestPermissions];    
    }
    
    //Set the delegate and authorize
    
    - (void)viewDidLoad
    {
    [super viewDidLoad];
    
    //Set the delegate
    [[Proximiio sharedInstance] setDelegate:self];
    
    //Init and add the map view
    _mapView = [[ProximiioMap alloc] initWithFrame:self.view.bounds token:token delegate:self];
    _mapView.showPoi = NO;
    [self.view addSubview:_mapView.view];
    //Authorize the application
    [[Proximiio sharedInstance] authWithToken:AUTH_TOKEN];
    }
    

    After adding the required frameworks and pods, using the Proximi.io Map features becomes super simple!

    Done! The Proximi.io Map is ready to be used.

    Access

    Unlike the Proximi.io base SDK, the Proximi.io Map uses an instance based system so you can have multiple map views that don't affect each other. See the Authentication step for an example.

    Authentication

    In order to use the Proximi.io Map SDK you will need to authenticate with an auth token when initing the ProximiioMap instance.

    #import <ProximiioMap/ProximiioMap.h>
    
    ProximiioMap *mapView = [[ProximiioMap alloc] initWithFrame:self.view.bounds token:token delegate:self];
    

    Providing Heading

    In order to use the navigation features, the SDK will need to receive the users current heading. Use the CLLocationManager and it's delegate CLLocationManagerDelegate to do so.

    #import <CoreLocation/CoreLocation.h>
    
    @interface ViewController () <ProximiioDelegate, ProximiioMapDelegate, CLLocationManagerDelegate>
    {
        CLLocationManager *locationManager;
    //...
    }
    
    //Update the heading on your ProximiioMap instance
    - (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading
    {
        [_mapView setDirection:newHeading.trueHeading animated:YES];
    }
    
    //After the Proximi.io SDK has been initialized.
    locationManager = [[CLLocationManager alloc] init];
    locationManager.delegate = self;
    
    // Start location services to get the true heading.
    locationManager.distanceFilter = 1000;
    locationManager.desiredAccuracy = kCLLocationAccuracyKilometer;
    [locationManager startUpdatingLocation];
    
    // Start heading updates.
    if ([CLLocationManager headingAvailable])
    {
        locationManager.headingFilter = 5.0f;
        [locationManager startUpdatingHeading];
    }
    

    Delegate

    Currently the delegate will only notify when the map view has finished loading.

    - (void)mapDidLoad:(ProximiioMap *)map;

    Object Management

    ProximiioMap

    Initialization

    ProximiioMap *mapView = [[ProximiioMap alloc] initWithFrame:self.view.bounds token:AUTH_TOKEN delegate:self];
    

    Init the ProximiioMap instance by providing a frame for the view, your authentication token and a delegate.

    - (ProximiioMap *)initWithFrame:(CGRect)frame token:(NSString *)token delegate:(id)delegate;

    Additionally you can use the isLoaded function to check if the map view has loaded.

    - (BOOL)isLoaded;

    Tint Color

    [mapView setTintColor:[UIColor blueColor]];
    

    Set the tint color of the map view.

    - (void)setTintColor:(UIColor *)tintColor;

    Map View Rotation

    [mapView setEnableRotate:NO];
    

    Enable the user to rotate the map. Default: YES

    - (void)setEnableRotate:(BOOL)enabled;

    Map View Pitch (Zoom)

    [mapView setEnablePitch:YES];
    [mapView setMinimumZoomLevel:5];
    [mapView setMaximumZoomLevel:25];
    [mapView setZoomLevel:22 animated:YES];
    

    Enable the user to zoom on the map. Default: YES

    - (void)setEnablePitch:(BOOL)enabled;

    Set minimum and maximum zoom levels. Parameter | Default --------- | ---- Minimum Zoom Level | 0 Maximum Zoom Level | 20

    - (void)setMinimumZoomLevel:(int)zoomLevel; - (void)setMaximumZoomLevel:(int)zoomLevel;

    Set the maps zoom level with or without animation.

    - (void)setZoomLevel:(int)zoomLevel - (void)setZoomLevel:(int)zoomLevel animated:(BOOL)animated;

    Map Center

    - (void)proximiioPositionUpdated:(ProximiioLocation*)location
    {
    [_mapView setCenter:location.coordinate zoomLevel:22 animated:YES];
    }
    

    Centers the map around the given coordinate and zoom level with or without animation.

    - (void)setCenter:(CLLocationCoordinate2D)coordinate; - (void)setCenter:(CLLocationCoordinate2D)coordinate animated:(BOOL)animated; - (void)setCenter:(CLLocationCoordinate2D)coordinate zoomLevel:(int)zoomLevel animated:(BOOL)animated;

    User Location

    - (void)proximiioPositionUpdated:(ProximiioLocation*)location
    {
    [_mapView setUserLocation:location];
    }
    

    Set the users location.

    - (void)setUserLocation:(ProximiioLocation *)location;

    User Heading/Direction

    Set the users heading and rotates the map without changing the current center or zoom level. See the Providing Heading section for an example.

    - (void)setDirection:(CLLocationDirection)direction - (void)setDirection:(CLLocationDirection)direction animated:(BOOL)animated;

    Floor Plans

    for(ProximiioFloor *floor in [[Proximiio sharedInstance] floors])
    {
    [_mapView addFloorPlanForFloor:floor];
    }
    

    Add or remove floor plans from the map view. Floor plans can be set up in the Proximi.io portal. Floor plan images will be overlayed on the map.

    - (void)addFloorPlanForFloor:(ProximiioFloor *)floor; - (void)removeFloorPlanForFloor:(ProximiioFloor *)floor;

    Overlay Circles

    //Example: Show geofences on the map
    - (void)proximiioUpdatedGeofences {
    for (ProximiioGeofence *geofence in [[ProximiioResourceManager sharedManager] allGeofences]) {
    [_mapView addCircleWithIdentifier:geofence.uuid coordinate:geofence.area.coordinate radius:geofence.radius];       
    }
    }
    

    Add circle overlays to the map or remove them.

    - (void)addCircleWithIdentifier:(NSString *)identifier coordinate:(CLLocationCoordinate2D)coordinate radius:(float)radius; - (void)removeCircleWithIdentifier:(NSString *)identifier;

    Markers

    Add markers to the map or remove them. See the ProximiioMarker section for more information and an example on markers.

    - (void)addMarker:(ProximiioMarker *)marker; - (void)removeMarker:(ProximiioMarker *)marker;

    Routing

    ProximiioLocation *exampleTargetLocation = [ProximiioLocation locationWithLatitude:37.331820 longitude:-122.031341];
    [_mapView routeTo:exampleTargetLocation levelFrom:0 levelTo:0];
    

    Start routing the user from his current position and level to a target location and level.

    - (void)routeTo:(ProximiioLocation *)location levelFrom:(int)levelFrom levelTo:(int)levelTo;

    The visuals for the routing can be modified with the following functions:

    Set the color of the route. - (void)setRouteColor:(UIColor *)routeColor;

    Set the opacity of the route. - (void)setRouteColorAlpha:(float)routeAlpha;

    Set the thickness (line width) of the route. - (void)setRouteLineWidth:(float)routeLineWidth;

    ProximiioMarker

    //Add input beacon markers on the map
    - (void)proximiioUpdatedInputs
    {
    for (ProximiioInput *input in [[ProximiioResourceManager sharedManager] allInputs])
    {
    if (input.type == kProximiioInputTypeIBeacon)
    {
    ProximiioMarker *marker = [[ProximiioMarker alloc] initWithCoordinate:input.location.coordinate identifier:input.uuid image:[UIImage imageNamed:@"ibeacon_marker"]];
    marker.title = input.name;
    marker.subtitle = @"iBeacon Input";
    [_mapView addMarker:marker];
    }
    else if (input.type == kProximiioInputTypeEddystone)
    {
    ProximiioMarker *marker = [[ProximiioMarker alloc] initWithCoordinate:input.location.coordinate identifier:input.uuid image:[UIImage imageNamed:@"eddystone_marker"]];
    marker.title = input.name;
    marker.subtitle = @"Eddystone Input";
    [_mapView addMarker:marker];
    }
    }
    }
    

    Initialization

    Init the ProximiioMarker instance by providing a coordinate and an identifier, as well as an optional image.

    - (ProximiioMarker*)initWithCoordinate:(CLLocationCoordinate2D)coordinate identifier:(NSString *)identifier - (ProximiioMarker*)initWithCoordinate:(CLLocationCoordinate2D)coordinate identifier:(NSString *)identifier image:(UIImage *)image;

    Title & Subtitle

    Set the title and subtitle of the marker.

    - (void)setTitle:(NSString *)title; - (void)setSubtitle:(NSString *)subtitle;