Android SDK 3.1
What changes when you move the Grovs Android SDK from 3.0 to 3.1.
3.1.0 adds push campaigns and in-app messages, and removes the messages inbox along with the dependencies it brought in. Most apps bump the version, add back any dependency they relied on, and fix what the compiler flags.
Requirements are unchanged: Android 5.0 (API 21), Kotlin 1.8 or later.
Checklist
- Bump the dependency to 3.1.0.
- Declare the libraries the SDK no longer brings in, if your app uses them.
- Remove the messages inbox from your UI.
- Update your own messaging service, if you have one.
- Check how you handle push taps.
- Rename custom events that use a reserved name.
- Check the other behavior changes.
- Optional: set up push campaigns, react to in-app messages and enable app ratings.
1. Bump the version
In your app-level build.gradle:
dependencies {
implementation("io.grovs:Grovs:3.1.0")
}The SDK now depends on androidx.webkit:webkit, for HTML in-app messages.
2. Declare libraries the SDK no longer brings in
The SDK used these only for the inbox screens. If your app uses any of them, declare them yourself, or the build fails with missing classes or resources:
com.google.android.material:materialandroidx.constraintlayout:constraintlayoutandroidx.navigation:navigation-fragment-ktxandroidx.navigation:navigation-ui-ktx
The SDK now depends on androidx.navigation:navigation-runtime-ktx instead, so trackNavigation still works.
3. Remove the messages inbox
The inbox is gone on the device and the backend. In-app messages replace it.
Grovs.displayMessagesFragment(onDismissed)is deprecated and shows nothing. It callsonDismissedonce on the main thread.- Both
Grovs.numberOfUnreadMessagesforms are deprecated and always yield0, the callback once on the main thread. They used to yieldnullwhen the SDK wasn't configured, was disabled or was offline. Grovs.setOnAutomaticNotificationsListenerandGrovsNotificationsListenerare deprecated. The listener is never called.- The SDK no longer displays dashboard messages automatically or calls the inbox endpoints.
Remove inbox buttons and unread badges. Campaigns built under Engage in the dashboard show on their own once the SDK is configured.
These were public and are now removed. Code that referenced them won't compile:
io.grovs.handlers.NotificationsManager, and everything inio.grovs.fragments,io.grovs.viewmodels,io.grovs.adaptersandio.grovs.model.notifications.- The generated
io.grovs.databindingclasses. - The extensions
Fragment.applySystemBarInsets,showProgressBar,hideProgressBarandNavController.safeNavigate. ActivityProvider.requireNotificationsListener.- The instance methods
displayMessagesFragment,numberOfUnreadMessages,setOnAutomaticNotificationsListenerandrequireNotificationsListeneronGrovsinstances. The companion methodsGrovs.displayMessagesFragmentand the others stay. - The four inbox methods on
IGrovsService.
The inbox resources are removed too. If your app overrode or referenced them, delete those references:
- The
Grovs*text and button styles, exceptGrovsInAppWindow. - The strings
grovs_messagesandgrovs_messages_empty. - The
grovs_*colors, exceptgrovs_push_notification_icon_tint. - The inbox layouts, navigation graph, slide animations and icons.
4. Update your own messaging service
If your app declares its own FirebaseMessagingService, replace handleGrovsNotification, now deprecated, with GrovsMessaging.handleMessage. In 3.0 it only handled inbox pushes; handleMessage handles push campaigns.
// 3.0
override fun onMessageReceived(message: RemoteMessage) {
if (handleGrovsNotification(message)) return
// your own messages
}
override fun onNewToken(token: String) {
super.onNewToken(token)
Grovs.pushToken = token
}
// 3.1
override fun onMessageReceived(message: RemoteMessage) {
if (GrovsMessaging.handleMessage(this, message)) return
// your own messages
}
override fun onNewToken(token: String) {
GrovsMessaging.onNewToken(token)
}You can also extend io.grovs.handlers.MessagingService instead. Either way, remove the SDK's service declaration from your merged manifest with tools:node="remove". See If your app has its own FirebaseMessagingService.
5. Check how you handle push taps
In 3.0 the SDK ignored Grovs push campaigns: Android showed background pushes, nothing showed foreground ones, and your app read the grovs_* intent extras itself. In 3.1:
- Taps reach your deep link listener. The SDK reports the open and calls
GrovsDeeplinkListenerwith the push data, merged over its link's data. If your app also routes from the intent extras, it routes twice. Remove your own routing for Grovs pushes. - Foreground pushes are shown. The SDK's messaging service, or
GrovsMessaging.handleMessage, now shows Grovs pushes while the app is open, with their image. If your app showed them itself, remove that code, or setGrovsMessaging.showForegroundNotifications = false. - Splash screens. If your launcher starts another activity without its extras, call
Grovs.handleNotificationOpen(intent)where the tap lands.
A push is a Grovs push when its data has a non-blank grovs_campaign_id. A blank or whitespace-only ID is no longer treated as one.
6. Rename reserved event names
track now refuses every name the backend reserves. Rename any custom event that uses one of these, newly refused in 3.1:
push_open, push_delivered, push_held, in_app_held, journey_entered, journey_held, journey_path.
7. Other behavior changes
- In-app messages show without code. Once your project has live in-app campaigns, they show in the app. Use
pauseInAppMessagesorsetInAppExcludedScreensto keep them off flows like checkout. - Notification permission. The SDK doesn't declare
POST_NOTIFICATIONS. On Android 13 and later, in-app campaigns with an "Ask for push permission" button aren't shown unless your app declares it. - App ratings. "Rate the app" campaigns need
com.google.android.play:review-ktxin your app. Without it they're skipped. - Values set before
configure.identifier,attributesandpushTokenset beforeconfigureare kept and sent once the SDK authenticates. They used to be lost.identifierandattributesset this way still win over the values the server holds. - Push token. A token set before authentication no longer clears the user identifier and attributes on the server. Token refreshes reach Grovs without app code.
- Small icon meta-data.
io.grovs.NotificationIconSmallacceptsandroid:resourceas well as a drawable name inandroid:value. - Screen tracking. Screens whose class is named
NotificationsMainFragment,NotificationsListFragment,NotificationDetailsFragmentorAutoDisplayedNotificationFragmentare now tracked like any other screen. - Event properties. Whole numbers in custom event properties are sent as whole numbers (
4, not4.0). - Custom service implementations.
BatchEventsResponsehas a newinAppfield, so its constructor andcopychanged, andIGrovsServicehas newinAppSyncandpushOpen(campaignId, sessionId)methods. This only affects code that constructs or implements these types. - Data safety. Push opens and in-app message interactions are now reported. Check your Google Play Data safety form against what the SDK collects.
Verify the upgrade
- Build with no missing-class or missing-resource errors.
- Open a Grovs link and check that your
GrovsDeeplinkListenerstill receives it. - In the dashboard, create an in-app campaign triggered on app open, use Send test with your own user identifier, and bring the app to the foreground. The message shows at the next sync.
- If you use push, send a campaign to your own user identifier and tap it, once with the app in the background and once with it open. The open shows in the campaign report, and the listener gets the push data once per tap.
Full list of changes: Android CHANGELOG.