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

By using the JSON configuration you can further expand the customization of our SDK. A stringified configuration (jsonConfig) is necessary for proper initialization of the SDK. You can either pass it as a string, or use the new SygicEngine.JsonConfigBuilder (available in SDK 17.1 and higher).
Example of how to use the JsonConfigBuilder:

val config = SygicEngine.JsonConfigBuilder()
config.mapReaderSettings().startupOnlineMapsEnabled(true)
val path = applicationContext.getExternalFilesDir(null).toString()
config.storageFolders().rootPath(path)
val clientID = "your_client_id"
config.authentication(clientID)

SygicEngine.initialize(
               this,
               null,
               null, config.build(), ...

the .build() method parses the config object into a string.

If you would like to build the JSON yourself and pass it directly as a string, it has to have a proper JSON structure, for example:

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