Skip to content

Latest commit

 

History

History
95 lines (83 loc) · 2.88 KB

README.md

File metadata and controls

95 lines (83 loc) · 2.88 KB

Core kit setup

Please read core kit SDK setup part first. ZTCoreKit

Gradle

If you use Gradle to build your project — as a Gradle project implementation dependency:

implementation "fr.zhortech.android:ztsportkit:$zhortechSdkVersion-prod"

Product initialization

For product initialization provide desired algorithm type ZTAlgorithmType

val algorithmType = ZTAlgorithmType.RUNNING // or ZTAlgorithmType.WALKING
val product = ZTSport(algorithmType)

Activity

Start

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
        }
    )

Activity data

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:

  1. timesmapt is integer in seconds
  2. integer part of longitude multiplied by 1000000
  3. integer part of latitude multiplied by 1000000
  4. 0 if activity was paused 1 otherwise

Realtime data

To request activity data in real time use:

val fields = list of desired fields
ZTSport.getActivityRealtime(fields)
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe(...)

Stop

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(...)

Results

Summary

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

Activity segments

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.