How to integrate the Fusion SDK ?
Our aim is to make the integration of Fusion as effortless as it can be. With merely a couple of lines of code, you can seamlessly incorporate the SDK into your application in less than a minute.
Getting Started
- Add authToken in gradle.properties
- Add the following lines in settings.gradle
- Add the following dependency to your build.gradle file.
- Sync project with gradle files.
authToken=jp_7o28n3bcvvrdra8cnp95v1sqii
repositories {
...
maven {
url "https://jitpack.io"
credentials { username authToken }
}
}
dependencies {
...
def version = 'v2.0.3.18'
implementation 'com.gitlab.grp-fusionsuite-mobilesdk:fusion-inspect-
android-sdk-kotlin-repo-v2:$version'
}
Usage
Initialize Fusion in Application class
class App : Application() {
override fun onCreate() {
super.onCreate()
FusionInspect.Builder(
app = this,
// place your client secret here
clientSecret = "...",
// place your project token here
projectToken = "...",
).build()
}
}
Fusion API Interceptor
An API interceptor is used to capture network logs to help developers identify crashes or bugs. These network logs can be viewed in the Fusion dashboard alongside specific bugs or crashes.
To add the Fusion API Interceptor to your Retrofit network configuration, follow these steps:
- Create a new instance of the FusionApiInterceptor class.
- Add the interceptor to your Retrofit OkHttpClient object.
- Rebuild and run your app.
Once you have added the Fusion API Interceptor, you can view the network logs in the Fusion dashboard by navigating to the Bugs or Crashes page.
fun getFusionRetrofit(): Retrofit {
return Retrofit.Builder()
.baseUrl("Your Base URL")
.client(
OkHttpClient.Builder()
.addInterceptor(FusionApiLoggingInterceptor())
.build()
)
.addConverterFactory(
GsonConverterFactory.create(
GsonBuilder().setLenient().create()
)
)
.build()
}