Skip to content

Android installation

  • minSdk 23 (Android 6.0) or higher
  • The team’s SDK key (rsk_…) from the form’s Share → Mobile app tab

The SDK is written in Kotlin and can be called from Java. The package is com.responsly.sdk.

The artifact is com.responsly:sdk. It is not on Maven Central. Make it available to your build as described in your access details, then add the dependency.

app/build.gradle.kts
dependencies {
implementation("com.responsly:sdk:1.34.0")
}

Call initialize once in Application.onCreate. Calls made before it (identify, track, screen and the rest) are remembered and applied when the SDK starts.

MyApp.kt
import android.app.Application
import android.content.pm.ApplicationInfo
import com.responsly.sdk.*
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
val debuggable = (applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE) != 0
Responsly.initialize(
applicationContext,
"rsk_…",
ResponslyOptions(logLevel = if (debuggable) LogLevel.DEBUG else LogLevel.ERROR)
)
}
}

Register the class if your app does not have an Application subclass yet:

AndroidManifest.xml
<application android:name=".MyApp">
<!-- activities -->
</application>

initialize is idempotent for the same key. Calling it with a different key resets the SDK’s local state first.

ResponslyOptions has two fields.

FieldValuesNotes
logLevelLogLevel.NONE, LogLevel.ERROR, LogLevel.INFO, LogLevel.DEBUGUse DEBUG while integrating. See Testing & debugging.
apiHostStringDefaults to https://api.responsly.com. Leave it unset unless Responsly support gives you another host.

The only permission the SDK uses is INTERNET. Most apps declare it already. If yours does not, add it:

AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />

The SDK does not read the advertising ID and needs no other permission.

Nothing to add. The SDK ships its own consumer rules, and they are applied to your build automatically.

  • Pass an activity. The SDK presents surveys above the app’s current activity by itself.
  • Handle the back button. System back closes a survey that the respondent is allowed to close.
Log.d("MyApp", "Responsly SDK ${Responsly.SDK_VERSION}") // 1.34.0

Run the app with LogLevel.DEBUG and filter Logcat by Responsly.