API 1.0

BlindSquare API 1.0

BlindSquare supports an application directed URL scheme that third-party applications can use to launch BlindSquare. Custom URL schemes can pass information to the application via a URL. This enables applications to open BlindSquare and display their information about a place in BlindSquare or start BlindSquare’s simulation mode. This can be done by providing GPS coordinates or a Foursquare VenueID. You can call these schemes from your application or use them as links in Emails or on websites.

Sending coordinates to BlindSquare:

blindsquare://api/place?lat=11.11&lon=22.22&name=XYZ&address=XYZ&phone=123&comment=optionalcomment&action=open

where:

  • lat = latitude
  • lon = longitude
  • name = name of the place (you have to UrlEncode this parameter)
  • address (optional) = address of the place (you have to UrlEncode this parameter)
  • phone (optional) = phone number of the place (you have to UrlEncode this parameter)
  • comment (optional) = text that is shown in an alert box when your link is opened (you have to UrlEncode this parameter)

Actions performed by the BlindSquare application (parameter action):

  • open – BlindSquare shows information about a place so users can save it as a favorite, start tracking it or start simulation mode
  • simulate – BlindSquare starts simulation mode using the coordinates provided

Longitude and latitude have to be expressed as decimals (65.5375).

Sending a Foursquare VENUE_ID to BlindSquare:

blindsquare://api/place?VENUE_ID=123123123&comment=optionalcomment&action=open

where:

  • VENUE_ID = Foursquare venue id
  • comment (optional) = text that is shown in an alert box when your link is opened (you have to UrlEncode this parameter)

Actions performed by the application (parameter action):

  • open – BlindSquare shows information about the place so users can save it as a favorite, start tracking it or start BlindSquare’s simulation mode
  • simulate – BlindSquare starts simulation with the coordinates provided

Objective C-code to run the BlindSquare application from within another application:


#import

- (NSString*) blindSquareSharingURLforLocation:(CLLocation*)location simulation:(bool)simulation name:(NSString*)name address:(NSString*)address phone:(NSString*)phone comment:(NSString*)comment;
{
NSString *commentStr = (comment?[NSString stringWithFormat:@"&comment=%@",[comment stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]:@"");
NSString *nameStr = (name?[NSString stringWithFormat:@"&name=%@",[name stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]:@"");
NSString *addressStr = (address?[NSString stringWithFormat:@"&address=%@",[address stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]:@"");
NSString *phoneStr = (phone?[NSString stringWithFormat:@"&phone=%@",[phone stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]:@"");
NSString *actionStr = (simulation?@"&action=simulate":@"&action=open");
return [NSString stringWithFormat:@"blindsquare://api/place?lat=%.6f&lon=%.6f%@%@%@%@%@",location.coordinate.latitude,location.coordinate.longitude,nameStr,commentStr,addressStr,phoneStr,actionStr];
}

- (void) openBlindSquareForLocation:(CLLocation*)location simulation:(bool)simulation name:(NSString*)name address:(NSString*)address phone:(NSString*)phone comment:(NSString*)comment;
{
NSString* strUrl = [self blindSquareSharingURLforLocation:location simulation:simulation name:name address:address phone:phone comment:comment];
NSURL *url = [NSURL URLWithString:strUrl ];
[ [UIApplication sharedApplication ] openURL:url ];
}

- (bool) isBlindSquareInstalled;
{
NSURL *url = [NSURL URLWithString:@"blindsquare://api/place" ];
return [[UIApplication sharedApplication]canOpenURL:url];
}

- (NSString*) urlForPurchaseBlindSquare; //If isBlindSquareInstalled=NO, this method can be used to request link for purchasing BlindSquare
{
return @"itms-apps://itunes.apple.com/us/app/blindsquare/id500557255?mt=8&uo=4";
}

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Available on the App Store
On Twitter