Please read core kit SDK setup part first. ZTCoreKit
If you use Gradle to build your project — as a Gradle project implementation dependency:
implementation "fr.zhortech.android:ztsportkit:$zhortechSdkVersion-prod"
For product initialization provide desired algorithm type ZTAlgorithmType
val algorithmType = ZTAlgorithmType.RUNNING // or ZTAlgorithmType.WALKING
val product = ZTSport(algorithmType)
To start activity first set user parameters:
val userParameters = ZTUserDataParameters()
userParameters.bodyWeight = ...
userParameters.bodyHeight = ...
userParameters.shoeSize = ...
ZTSport.setUserParameters(userParameters)
Next, call start activity with chosen goal
ZTSport.startActivity(ZTSportActivityAttributes(goal, goalValue))
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
{
//activity started
},
{
//error
}
)
You can provide data of current activity by:
ZTSport.addActivityData(timeStamp, activityData)
where activityData
is a list of data that gather by application. In case of ZTSport pruduct it is:
- timesmapt is integer in seconds
- integer part of longitude multiplied by 1000000
- integer part of latitude multiplied by 1000000
- 0 if activity was paused 1 otherwise
To request activity data in real time use:
val fields = list of desired fields
ZTSport.getActivityRealtime(fields)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(...)
Activity can be stopped explicitly:
ZTSport.stopActivity()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(...)
Or it could happen if modules go to sleep if there was no user activity. You should listen for this kind of stop:
ZTSport.observeRestoredActivity()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(...)
To request activity summary after stop call:
ZTSport.getActivitySummary(activityId, fields, include)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(...)
Where fields is array of of type ZTSportActivitySummary.Fields
, and include array of additional attributes that listed in zcloud docs
After activity is processed on zt cloud app can request the list of segments. Each segment respond to the deffirent "grade" of activity portion and have assigned color to represent that grade.
ZTSport.getMapRouteData(activityId)
If during activity application provided data with location, each segments will have respording coordinates set, so you cand draw them onto map.