SDKNativeEngine

public class SDKNativeEngine
extension SDKNativeEngine: NativeBase
extension SDKNativeEngine: Hashable

Holds internal services and configurations needed by various HERE SDK modules.

You can initialize the HERE SDK in two ways:

  • Create a shared instance of the SDKNativeEngine with SDKNativeEngine.makeSharedInstance().
  • Create individual instances of the SDKNativeEngine via SDKNativeEngine(). Note that this does not automatically set a shared instance.
  • Makes a new instance of SDKNativeEngine using supplied options.

    Throws

    InstantiationError Indicates what went wrong when the instantiation was attempted.

    Declaration

    Swift

    public init(options: SDKOptions) throws

    Parameters

    options

    The options for the new engine.

  • Options used by this instance of SDKNativeEngine.

    Declaration

    Swift

    public var options: SDKOptions { get }
  • Shared instance of this SDK engine that can be accessed by any HERE SDK module as the default engine. This is automatically set as a part of the SDK initialization process.

    Declaration

    Swift

    public static var sharedInstance: SDKNativeEngine? { get set }
  • The offline mode. Sets offline mode for the HERE SDK to offline or online. Defaults to false, which means the HERE SDK uses an online connection. When enabled, this prevents the HERE SDK from initiating any online connection except for provided pass through features if set. See SDKNativeEngine.passThroughFeatures. Note that the flag does not cancel pending requests. The mode can be enabled or disabled at any time. In order to fully operate offline, the mode needs to be enabled via SDKOptions.offlineMode. Initialization of the HERE SDK itself does not require an internet connection. Returns true if the HERE SDK uses offline connection mode, otherwise returns false.

    Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.

    Declaration

    Swift

    public var isOfflineMode: Bool { get set }
  • The pass through features. Sets pass through features which are allowed to use online data when HERE SDK is in offline mode. Pass through features can be updated at any time. When offline mode is disabled, existing pass through features will be removed. These needs to be set again when you enable offline mode next time. By default, reporting of HERE SDK UsageStats will be enabled when at least one pass-through feature is set.

    Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.

    Declaration

    Swift

    public var passThroughFeatures: Set<PassThroughFeature>? { get set }
  • Configuration for default values of parameters used in the HERE SDK. Note: This feature is in beta state and thus there can be bugs and unexpected behavior. Related APIs may change for new releases without a deprecation process.

    Declaration

    Swift

    public static var parameterConfig: ParameterConfiguration { get set }
  • Proxy settings of this SDK engine that will be used by HERE SDK network for all requests. Defaults to (nil), which indicates proxy is not enabled. When setting proxy settings, they will immediately be applied and all the pending and fresh requests will use these settings. Pass (nil) to indicate that proxy should be disabled. If proxy is necessary from the start then it’s recommended to use NetworkSettings.proxySettings in SDKOptions.networkSettings.

    Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.

    Declaration

    Swift

    public var proxySettings: ProxySettings? { get set }
  • Gets a list of usage statistics for all available HERE SDK features. UsageStats has cache and persistent storage. Reads from the persistent storage happen on SDKNativeEngine creation step. Writes to persistent storage happen by reaching internal limit (amount of upload bytes, by default is 50KB).

    Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.

    Declaration

    Swift

    public var sdkUsageStats: [UsageStats] { get }
  • Enum representing a strategy to flush memory caches.

    See more

    Declaration

    Swift

    public enum PurgeMemoryStrategy : UInt32, CaseIterable, Codable
  • Overrides HERE SDK access key secret with new value. The new credentials will be used for new requests.

    Note: This method can be called from any thread. Access key ID can be set with constructor of SDKNativeEngine. New instance of SDKNativeEngine should be used if a new access key ID is required.

    Declaration

    Swift

    public func setAccessKeySecret(accessKeySecret: String)

    Parameters

    accessKeySecret

    New access key secret.

  • Overrides the token scope of the HERE SDK with new value. A new token will be fetched with the set scope and used for future requests. Setting an empty string will fetch a token for the global scope.

    This method can be called from any thread.

    Declaration

    Swift

    public func setAccessScope(scope: String)

    Parameters

    scope

    New scope for token

  • Enable or disable UsageStats for the HERE SDK. Defaults to disabled (false). When enabled, SDKNativeEngine.getSdkUsageStats() returns actual online data consumption. Note that the flag does not cancel pending requests. UsageStats can be enabled or disabled at any time.

    Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.

    Declaration

    Swift

    public func enableUsageStats(enabled: Bool)

    Parameters

    enabled

    True, if UsageStats are enabled.

  • Makes a new instance of SDKNativeEngine using supplied options and stores it as shared instance see SDKNativeEngine.sharedInstance. If there was previously shared instance then it’s destroyed before new instance is created.

    Throws

    InstantiationError Indicates what went wrong when the instantiation was attempted.

    Declaration

    Swift

    public static func makeSharedInstance(options: SDKOptions) throws

    Parameters

    options

    The options for the new engine.

  • Clear persistent storage for the HERE SDK UsageStats. Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.

    Declaration

    Swift

    public func clearPersistentUsageStats()
  • Clear cache for the HERE SDK UsageStats. Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.

    Declaration

    Swift

    public func clearUsageStatsCache()
  • Releases memory occupied by internal caches. Purging caches reduces memory footprint of application and may temporary reduce performance.

    Declaration

    Swift

    public func purgeMemoryCaches(strategy: SDKNativeEngine.PurgeMemoryStrategy)

    Parameters

    strategy

    Option to control how much memory caches will be purged.

  • The unique identifier assigned to the device for this application. This device ID is primarily used for tracking Monthly Active Users (MAUs).

    Declaration

    Swift

    public func getDeviceId(completion: @escaping DeviceIdHandle)

    Parameters

    completion

    Callback which receives the result on the main thread.