How to use HERE Navigate SDK Usage Stats API in 4.15.1 + ?
HERE Navigate SDK 4.15.1 introduced a new API named as Usage Stats Api which enables the user to keep track of the network statics related to the HERE SDK. This enables a transparent flow of information from the SDK to end user with respect to network traffic consumption. If you want to integrate this api in your application you will need to perform this additional steps -
1. During the start of your application you need to add the following snippet -<br /> val sdk:SDKNativeEngine = SDKNativeEngine.getSharedInstance()!! sdk.enableUsageStats(true)<br />
2. Now, once you have enabled this , you can use the below snippet to get the NetworkStats -<br /> val usageStats = SDKNativeEngine.getSharedInstance()!!.sdkUsageStats usageStats.forEach { usageStat -> Log.d(TAG," Feature ${usageStat.feature}") usageStat?.networkStats?.forEach { networkstat -> Log.d(TAG, " Method name - ${networkstat.methodCall}"+" Received - ${networkstat.receivedBytes}"+" Sent - ${networkstat.sentBytes} "+" Request Counter ${networkstat.requestCounter}") } }<br />
For more information about the api please have a look at - https://www.here.com/docs/bundle/sdk-for-android-navigate-api-reference/page/com/here/sdk/core/engine/UsageStats.html