# Quick Start
This walkthrough shows how to add Storyly to your Android application and show your first story in it.
You can also check out the demo on GitHub
Before you begin
This walkthrough contains sample instance information. However, if you want to work with your own content as well, please login into Storyly Dashboard (opens new window) and get your instance token.
The sample instance information for testing purposes;
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY2NfaWQiOjc2MCwiYXBwX2lkIjo0MDUsImluc19pZCI6NDA0fQ.1AkqOy_lsiownTBNhVOUKc91uc9fDcAxfQZtpm3nj40
# Installation
First, declare the dependency for the Storyly SDK in your app’s module Gradle file (usually app/build.gradle
).
android {
dependencies {
...
// You should add this line
implementation 'com.appsamurai.storyly:storyly:<latest-version>'
...
}
}
TIP
Please do not forget to replace <latest-version>
. The latest version is (opens new window)
WARNING
Storyly SDK targets Android API level 17 (Android 4.2, Jelly Bean)
or higher.
WARNING
You need to add Java 1.8 compatibility configuration. In your app’s module Gradle file (usually app/build.gradle
), please add the following instructions:
android {
compileOptions {
// You should add these two lines
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
WARNING
If your application targets devices that does not contain Google APIs, you need to initialize EmojiCompat (opens new window) class to use Emoji related features of Storyly such as Emoji and Rating Components. Otherwise, you will encounter a crash whenever you use any of these components in your Storyly instance.
Please follow Emoji Compat Bundled Fonts initialization steps (opens new window) to use Emoji features of Storyly.
# Add Storyly View
You can add StorylyView
to your app either from XML layout or using the programmatic approach.
StorylyView
extends ViewGroup
so that you can use inherited functionality as it is. So, you can add StorylyView to any of the app’s layouts as a View component.
# Adding from XML Layout
Open your XML layout and add these lines wherever you want to add StorylyView
<com.appsamurai.storyly.StorylyView
android:id="@+id/storyly_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
# Programmatically
StorylyView
extends ViewGroup
so that you can use inherited functionality as it is. So, you can initialize StorylyView using View’s constructors.
# Initialize StorylyView
You are one step away from enjoying Storyly. You just need to initialize StorylyView
.
TIP
Please do not forget to use your own token. You can get your token from the Storyly Dashboard -> Settings -> App Settings (opens new window)
Just hit the run. Now, you should be able to enjoy Storyly
🎉!
WARNING
If you can't see Storyly in your application, please check that your token is correct. For more details please check console logs.