Introduction
This document shares detailed integration steps for GluedIn widgets for profiles, videos, hashtags and challenges in your existing application or a new app.
Benefits of GluedIn widget?
GluedIn provide widgets which can be used inside a new or any existing application with predefine line of code, almost no development experience required to use widget inside your application. Below are the available widgets which can be used in your application:
- If Android studio is not installed on your machine, please download from here and install.
- Profile (Top profile)
- Videos (Fresh arrival videos)
- Hashtags
- Challenges
Pre-Requisites
- If Android studio is not installed on your machine, please download from here and install.
- Set the Java version in Android studio for compiling the project. Please follow the instructions here.
- Min Requirements for Gluedin Android SDK
- minSDK – 23
- Max compileSDK – 32
- Min complieSDK - 29
- Max targetSDK – 32
- Min targetSDK - 29
- Min Java Version – 11.0
Below are the define steps to follow if you want to integrate GluedIn Widget in your application.
Note: Currently only No Code GluedIn SDK have widgets support.
1.Integrate the Android No Code GluedIn SDK into your app by following the steps mentioned in the Link.
2.Now Add the GluedIn widget in the XML file of the activity or fragment.
3. Now initialize the widget reference into your UI class (Activity or Fragment) and call the "load" method to load the widget.
gluedInWidget = findViewById(R.id.gluedInWidget)
gluedInWidget?.load("widget_id", referenceOfTheActivity)
4.Before calling the "load" method, make sure GluedIn SDK is initialized properly.
5.To initialize the SDK and to validate the API and Secret key of the GluedIn SDK use the validateGluedInSDK method and once SDK has been initialized successfully then call the loadmethod of the widget.
val callback: GluedInSDKCallBack = object : GluedInSDKCallBack {
override fun onSdkInitSuccess(
isSuccess: Boolean,
gluedInSdkException: GluedInSdkException?
) {
if (isSuccess) {
gluedInWidget?.load("30c1a922-ad46-40a4-8473-70bc6167c2ec", this@WidgetActivity)
} else {
Toast.makeText(
this@WidgetActivity,
"GluedIn SDK Launched Failed" + gluedInSdkException?.message.orEmpty(),
Toast.LENGTH_SHORT
).show()
}
}
override fun onAppAuthSuccess(isSuccess: Boolean,gluedInSdkException: GluedInSdkException?) = Unit
}
val gluedInConfigurations = GluedInInitializer.Configurations.Builder()
.setSdkCallback(callback)
.setApiKey("put_your_api_key_here")
.setSecretKey("put_your_secret_key_here")
.setDeeplinkAuthority("www.sample.com")
.setFeedType(GluedInInitializer.Configurations.FeedType.SQUARE)
.create()
gluedInConfigurations.validateGluedInSDK(this,GluedInConstants.LaunchType.APP)
GluedIn Widget provides multiple below callback methods for below events:
- GluedInWidgetLoadListener - Provides callback method related to widget load, whether widget loaded successfully or not
- GluedInWidgetClickListener - Provides callback related to click listeners of the widget.
Class Name: GluedInWidgetLoadListener
Available Callback Methods: Below are the methods which will be triggered based on widget load results.
fun onWidgetLoadSuccess(status: Boolean, message: String)
fun onWidgetLoadFailure(message: String)
Class Name: GluedInWidgetClickListener
Available Callback Methods: Below are the methods which will be triggered on item action click
fun onProfileItemClick(data: RailItem, position: Int)
fun onVideoItemClick(data: RailItem, position: Int)
fun onChallengeItemClick(data: RailItem, position: Int)
fun onHashtagItemClick(data: RailItem, position: Int)
fun onCategoryItemClick(data: RailItem, position: Int)