Json Configuration

Starting with the version of SDK 8.0.0 you now have full power to configure multiple aspects of SDK.

This document describes how to include json configuration file in your project.

Minimal required configuration can be found here Minimal Json Configuration

For full description of Json Configuration follow Full Json Configuration and Json Schema Documentation for documentation.

iOS

Configuration json is an optional file you can place into your app. If there is no need to change default configuration you can ignore the file and set your application credentials directly to[SYContext initWithAppKey:appSecret:onlineRoutingKey:completion] method.

For custom configuration, load the json file and pass its content as NSDictionary to [SYContext initWithConfiguration:completion] method:
In Swift

do {
    if let configData = try String.init(contentsOfFile: Bundle.main.path(forResource: "your_config_file", ofType: "json")!).data(using: .utf8) {
        let dict:[AnyHashable: Any] = try JSONSerialization.jsonObject(with: configData, options: .mutableContainers) as! [AnyHashable: Any]
        SYContext.initWithConfiguration(dict) { [weak self] initResult in

        }
    }
} catch {
    // catch errors
}

Or in Objective-C

NSData *configData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"settings_app" ofType:@"json"]];
NSError* error = nil;
NSMutableDictionary *dict = [NSJSONSerialization JSONObjectWithData:configData options:NSJSONReadingMutableContainers error:&error];

if(error) {
    // your error handling code
    NSLog(@"%@", [error localizedDescription]);
}    

[SYContext initWithConfiguration:dict completion:^(SYContexInitResult result) {
    // your init completion code
}];

Android

Configuration json is an optional file you can place into your app. If there is no need to change default configuration you can ignore the file and set your key and secret directly to SygicEngine.Builder with setKeyAndSecret method.

Custom configuration options

If custom configuration is required place json file named settings_app.json into app's asset folder so SDK can pick it up and read the config values. There are lot of parameters you can configure with the json but there are few mandatory:

{
  "Authentication": {
    "app_key": "<your app key>",
    "app_secret": "<your app secret>"
  }
}

Note: The key and secret pair can be set by SygicEngine.Builder as decribed above