Standalone player sample
Add the SDK
First add the SDK and required dependencies in your app/build.gradle file.
You can check the latest SDK version on Maven Central.
dependencies {
[...]
implementation 'com.joinstoriessdk:androidsdk:X:X:X'
[...]
}
Init
Then you should init the SDK. There isn't any side effect so you can implement it wherever you want. Just be sure to call the init method before any start method.
JoinStories.init(this, your_team_id)
Layout
Now you need to add our StoryPlayer view withing the layout of the Activity/Fragment that will be responsible to trigger its display.
<com.joinstoriessdk.androidsdk.ui.player.StoryPlayer
android:id="@+id/story_player"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@android:color/white"
android:translationZ="16dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:playerCornerRadius="10"
app:playerClosingButton="true"
app:playerShowShareButton="false"
app:playerProgressBarDefaultColor="#00FF66"
app:playerProgressBarFillColor="#FF3FFF"
app:playerProgressBarThickness="8"
app:playerProgressBarRadius="0"/>
Trigger
At this point you are now ready to plug the StoryPlayer launch on your own flow, by calling the startPlayer method.
It could be on a button click for example:
binding.btnLaunchPlayer.setOnClickListener {
binding.storyPlayer.startPlayer("your_alias")
}
For a complete list of the available configuration parameter, see the Standalone Player document of the usage section.