UprateSDK for Android
Roadmap voting, in-app feedback, and review insights for your Android app.
Dashboard • Website • Quick Start
- Android API 24+ (Android 7.0)
- Kotlin 2.0+
Add the JitPack repository to your app's settings.gradle.kts:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven("https://jitpack.io")
}
}Add the dependency to your app's build.gradle.kts:
dependencies {
implementation("com.github.UprateHQ:uprate-android-sdk:0.2.0")
}If the repository or JitPack artifact is private, add your JitPack token to
~/.gradle/gradle.properties:
authToken=YOUR_JITPACK_TOKENThen configure the JitPack repository with credentials:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven("https://jitpack.io") {
credentials {
username = providers.gradleProperty("authToken").orNull
password = ""
}
}
}
}Do not commit JitPack tokens to your repository.
In your UprateHQ dashboard, open Apps, find your app, and choose SDK API Keys to generate a publishable key. It starts with uprt_pub_ — that is the one the SDK needs.
Heads up: keys from Settings > API keys are for the REST API and won't work with the SDK. The secret key (
uprt_secret_) from the SDK key pair belongs on your server, never in the app.
Call configure once at app launch in your Application.onCreate(), before using any features:
import com.upratehq.sdk.UprateSDK
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
UprateSDK.configure(
context = this,
apiKey = "uprt_pub_your_publishable_key"
)
}
}After the user logs in, set their identity:
UprateSDK.instance.setUserContext(
userId = "user_123",
email = "[email protected]",
name = "Jane",
userToken = userTokenFromYourServer
)Call clearUserContext() on logout.
userToken is optional. Generate it on your server as the hex HMAC-SHA256 of the
user ID, signed with your SDK secret key. The SDK sends it as X-SDK-User-Token
on every request until the context is cleared or replaced. Never put the secret
key in your app. See Verify users.
// Fetch roadmap items
val roadmap = UprateSDK.instance.roadmap.getItems()
// Vote on an item
val result = UprateSDK.instance.roadmap.vote(itemId = item.id)
// Submit a feature request
val request = UprateSDK.instance.roadmap.submitRequest(
title = "Dark mode",
description = "Please add dark mode support"
)// Submit feedback with optional rating
val result = UprateSDK.instance.feedback.submit(
message = "Checkout is slow but the app looks great",
rating = 4,
metadata = mapOf("screen" to "checkout")
)
// List user's submissions
val submissions = UprateSDK.instance.feedback.getMySubmissions()Fetch unread replies when your activity resumes. This example uses your app's
AndroidX lifecycleScope; the SDK adds no lifecycle dependency or observers.
showRepliesAndAwaitDismissal is your app's suspending UI function: return only
after the user has read the replies, then mark them read.
import androidx.lifecycle.lifecycleScope
import com.upratehq.sdk.networking.UprateError
import kotlinx.coroutines.launch
override fun onResume() {
super.onResume()
lifecycleScope.launch {
try {
val feedback = UprateSDK.instance.feedback
val replies = feedback.getUnreadReplies()
if (replies.isNotEmpty()) {
showRepliesAndAwaitDismissal(replies)
feedback.markRead(replies)
}
} catch (error: UprateError) {
handleReplyError(error)
}
}
}getUnreadReplies() returns up to 100 replies, oldest first. markRead(replies)
marks those replies read; an empty list makes no request. Feedback history also
includes each submission's replies, defaulting to an empty list on older servers.
Each FeedbackReply has id, feedbackId, body, createdAt, and nullable
readAt; timestamps are ISO 8601 strings.
If the user context changes during one of these requests or getMySubmissions(), the SDK
throws UprateError.UserContextChanged instead of returning the previous user's result.
Dismiss any replies already shown when the user logs out or switches accounts.
Uprate sends a notification that a reply is available, without the reply text.
Upload your Firebase service-account JSON on the SDK page's Push tab. Apps made
for kids can't use push; registerPushToken throws UprateError.FeatureNotEnabled
for them.
Your app handles notification permission, FCM tokens, and taps; the SDK adds no
Firebase dependency.
After setUserContext, get the current FCM token with
FirebaseMessaging.getInstance().token and register it. Also register refreshed
tokens from FirebaseMessagingService.onNewToken once the user context is set.
Call the suspending SDK methods from your app's coroutine scope:
UprateSDK.instance.feedback.registerPushToken(token)On logout, unregister the current token before clearing the user context. Until the device is unregistered or someone else registers it, it can still get the previous person's reply notifications (they never carry the reply text). If unregistering fails, keep that person's user ID, user token and the device token, and on the next start set that user context again, unregister, then clear it:
// Clear the user context even when unregistering fails, for example offline.
runCatching { UprateSDK.instance.feedback.unregisterPushToken(token) }
UprateSDK.instance.clearUserContext()Use replyId(fromPush) to recognize Uprate's push data. On notification tap, pass
the notification's data to your tap handler and fetch the replies:
import com.upratehq.sdk.features.feedback.UprateFeedback
if (UprateFeedback.replyId(fromPush = data) != null) {
val replies = UprateSDK.instance.feedback.getUnreadReplies()
showRepliesAndAwaitDismissal(replies)
UprateSDK.instance.feedback.markRead(replies)
}Record when you show the Google Play review prompt to enrich review data in your dashboard:
val manager = ReviewManagerFactory.create(context)
val request = manager.requestReviewFlow()
request.addOnCompleteListener {
if (it.isSuccessful) {
manager.launchReviewFlow(activity, it.result)
lifecycleScope.launch {
try { UprateSDK.instance.reviews.recordPrompt() } catch (_: Exception) { }
}
}
}- Roadmap & Voting — Let users browse your roadmap and vote on features
- In-App Feedback — Collect feedback with optional ratings and device metadata
- Review Signals — Match Google Play reviews to users for richer insights
- Coroutines — Modern Kotlin coroutines with
suspendfunctions throughout - Lightweight — Minimal dependencies: OkHttp and kotlinx.serialization
- Testable — Interface-based design with
RoadmapProviding,FeedbackProviding, andReviewSignalProvidingfor easy mocking - Privacy-Conscious — No tracking, no advertising identifiers, no fingerprinting. Device metadata (model, OS version) is collected only with feedback and review signals, and can be disabled
SDK calls throw UprateError. UserTokenRejected(message) means the server requires
a user token or rejected the supplied token; message preserves the server's
explanation. Other 401 responses still throw InvalidApiKey. UserContextChanged
means a replies request completed after the context changed; discard it and fetch
again for the current user. UserContextNotSet means you need to set the user's
identity before calling a feature.
The SDK provides interfaces for each feature module, making it easy to mock in your tests:
class MockRoadmap : RoadmapProviding {
override suspend fun getItems(): UprateRoadmapResponse { ... }
override suspend fun vote(itemId: String): VoteResult { ... }
// ...
}- No tracking — no advertising identifiers, no fingerprinting
- Permission — INTERNET only
- Device metadata (model, OS version, locale, RAM, free disk) is collected with feedback submissions and review signals. Disable it per-feature with
feedback.collectDeviceMetadata = false - User identity (
userId,email,name, optionaluserToken) is provided by your app — the SDK does not gather it independently - No local storage — all data is transient, fetched on demand
UprateSDK is available under the MIT License. See LICENSE for details.