Android
Release history for the Swan Android SDK.
[android/1.2.0] — 2026-10-30
Artifact: cx.swan:swan-android-sdk:1.2.0 on Maven Central
Min SDK: 21 (Android 5.0) · Target/Compile SDK: 34 · Kotlin: 2.0.21 · AGP: 8.7
Added
- Missed pushes are recovered. When Swan has turned recovery on for your push integration, a push the phone never received (for example because it was offline, or the system stopped the app in the background) is fetched when the app opens or comes to the foreground and in a periodic background check, and shown once while it is still valid — standard, image and carousel pushes alike. A push is never shown twice, whichever way it arrives, an expired push is never shown, and nothing is fetched or shown while push is off in
SwanConfig, afterSwan.unsubscribePush()(untilSwan.subscribePush(), which turns recovery back on straight away), or while the user has turned off notifications for your app. Recovered pushes report delivery and taps like any other push, marked as recovered in campaign reports. No code changes are needed if Swan pushes reach the SDK'sSwanMessagingService(directly or through a subclass that callssuper); an app that shows Swan pushes from its ownFirebaseMessagingServiceshould subclassSwanMessagingServiceinstead so the SDK shows them. The background check addsandroidx.work:work-runtime-ktx2.9.1 to your app, which merges WorkManager's own manifest entries into your app (theWAKE_LOCK,ACCESS_NETWORK_STATE,RECEIVE_BOOT_COMPLETEDandFOREGROUND_SERVICEpermissions and WorkManager's services and receivers). See Recover missed pushes. - Delivery and tap receipts for pushes sent by the Swan platform. Receipts are saved on the device and retried automatically if the device is offline, and the same receipt is never counted twice. Receipts need no sign-in: delivery is reported whether or not the customer is signed in. A tap on a carousel card says which card was tapped, as click reports already do.
- Right-to-left carousels. A carousel whose text is right-to-left (for example Arabic) is laid out right to left — mirrored chevrons and slide direction, right-aligned text — with the card order unchanged. Requires
android:supportsRtl="true"on your application. Swan.subscribePush()turns push back on afterunsubscribePush(). It fetches the FCM token and registers it with Swan. It returns aResult: on success, the registered token, ornullif Firebase can't provide one yet (for example, before notification permission is granted) orunsubscribePush()was called again before it finished; on failure, the reason the token wasn't registered. If the SDK isn't initialized or push is disabled inSwanConfig, nothing changes. On a Firebase or network error push is back on and the token is registered with the next token refresh orregisterFcmToken/requestFcmTokencall; you can also callsubscribePush()again. WhenunsubscribePush()andsubscribePush()are called in quick succession, the last call wins;subscribePush()counts from when its coroutine runs. Call it from your in-app "turn notifications on" control.
Fixed
- A manual
Swan.ackPushDeliveredcall with the FCM message id no longer reports a delivery twice. A call for a push the SDK had already reported was ignored only when it passed Swan's message id; passingRemoteMessage.messageIdreported the push a second time. Either id is now matched. - A push's custom sound, or
soundnone, now takes effect on Android 8 and later. On Android 8 and later a notification channel decides the sound, so a push asking for a bundled sound (res/raw/<name>) or for no sound played the channel's sound. The SDK now posts such a push on a channel derived from the one it would use, with the same importance and settings and that sound or no sound (<channelId>__snd_<name>or<channelId>__silent), created the first time a push uses that sound. A push withsoundnone plays no sound and does not vibrate; a push with a custom sound keeps the vibration of its channel. A sound your app doesn't bundle, or a channel you created with its own sound, keeps the channel's sound. This applies to standard and carousel pushes, however they arrive. If the user has turned that channel off, the push stays off; if the user changes the channel's settings later, the SDK re-creates its derived channel to match (its id may gain a__v<n>suffix). A sound name is matched to your bundled sound in lower case, ignoring characters other than letters, digits and_. - Turning notifications on recovers missed pushes right away. After the user allows notifications — from the in-app permission prompt or in system Settings — the missed-push check runs at once (for Settings, on the next return to the app) and records the change only once.
- Fewer requests when the network is down. Several events tracked at once while sends are failing no longer start a send each; they share one, so the first retry round sends at most three requests.
- Receiving a push is no longer reported as a tap. Previously a push that arrived while the app was running fired
addNotificationOpenedListenerand a click receipt even though the user had not tapped it — and a real tap shortly afterwards could go uncounted. Opened and tapped now fire only when the user taps the notification, exactly once per tap. - Silent pushes no longer fire
addNotificationOpenedListener. A silent push now firesaddPushNotificationReceivedListenerand is reported as delivered, never as tapped. - Events queued during an outage are kept and retried. An event was given up on after three failed sends, even when the sends failed only because the device was offline or the server was briefly unavailable, so an outage longer than a few flush attempts lost events. Network errors, timeouts and HTTP 408, 429 and 5xx answers now keep the event queued and retry it with backoff (up to 60 seconds apart, honouring
Retry-After) until it is sent. An event is dropped only when the server rejects it (any other 4xx) on three attempts, when it is still unsent 7 days after it was tracked, or when the queue is full (5,000 events) and the oldest events make room for new ones; the SDK logs each drop. Failed sends during an outage never count toward those three rejections. When the server rejects a whole request (HTTP 4xx, including 413 for a request that is too large), the SDK resends its events one at a time right away, so only the event the server rejects on its own is charged and the others are delivered. If the server answers HTTP 5xx three times in a row for the same batch, the SDK resends its events one at a time, so an event the server always fails on no longer holds up the events queued behind it for up to 7 days. If the first single send fails, the SDK sends the newest queued event on its own to check whether the server is up: if it is, the events behind the failing ones are still delivered; if not, it treats it as an outage, stops, and retries later without counting anything. An event is counted as rejected for HTTP 5xx only after it has already failed on its own in an earlier attempt and fails on its own twice more while newly queued events are being accepted in two attempts in a row (and never more such events than were accepted), so an event is never dropped as rejected because the server failed requests at random (the 7-day limit and the 5,000-event cap still apply), and several events the server can't process no longer hold up the queue. While the server'sRetry-Afterwait is running, no flush sends queued events, whatever starts it — the periodic flush, a full batch, the app returning to the foreground, or an explicit flush. Events dropped because the queue is full (5,000 events, oldest first) are now counted and logged like other drops. Events an earlier version had given up on in the last 7 days are sent again after the update. A response that doesn't confirm an event — no entry for it, or no readable list of results — now leaves the event queued and retried, neither counted as rejected nor treated as sent. appLaunchedand other early events carrycountry,currencyandbusinessUniton every launch. These values were kept only in memory, so on each launch the events the SDK sent before your code set them again —appLaunchedabove all — went out without them, and a value set beforeSwan.init(...)was ignored. The SDK now keeps them across launches until you change them (an empty string clears one), applies them before it sends its first event, and applies values set beforeSwan.init(...). On the very first launch, set them beforeSwan.init(...)so the firstappLaunchedcarries them. A changed value applies to every event tracked after the change, and an event keeps the values it had when it was tracked — previously an event tracked before the device was registered took the values current at registration.unsubscribePush()now keeps the device unsubscribed. AfterunsubscribePush(), the next FCM token refresh registered the device with Swan again, as did calls toregisterFcmTokenorrequestFcmToken, so a customer who turned notifications off kept receiving pushes. The device now stays unsubscribed — across launches, token refreshes, login and logout — until your app callssubscribePush(). While unsubscribed,requestFcmToken()returnsnullandregisterFcmTokendoes nothing. Upgrading from Android 1.1.4 or earlier: those versions did not remember a push opt-out after the app restarted (the device was registered again at the next launch), so a device that unsubscribed on them counts as subscribed after the update. For customers who have opted out, callunsubscribePush()after updating, so their choice is kept from now on.
[android/1.1.4] — 2026-10-18
Artifact: cx.swan:swan-android-sdk:1.1.4 on Maven Central
Min SDK: 21 (Android 5.0) · Target/Compile SDK: 34 · Kotlin: 2.0.21 · AGP: 8.7
Added
- Carousel clicks report which card was tapped. When the user taps a card in a
manualcarousel, the click sent to Swan now includes which card it was: its position in the push'scarouselItems, starting from0. The position stays correct when the filmstrip layout skips a card without an image. A tap elsewhere on the notification, a tap on anautocarousel, and a tap on a standard push are reported as clicks with no card. No code change is needed.
Fixed
- Push deliveries are now reported automatically. Apps whose Swan pushes are handled by the SDK's built-in
SwanMessagingService(directly, or through a subclass that callssuper.onMessageReceived) never reported Android deliveries unless they calledSwan.ackPushDeliveredthemselves. Every Swan notification the SDK shows is now reported as delivered once, whether the app is in the foreground, in the background, or closed. A report that can't be sent right away (for example, while the device is offline) is kept for up to 7 days and sent the next time the app is opened. The report is sent when the SDK hands the notification to Android, so it is sent even if the user has turned off notifications for your app. Silent pushes are still not reported.- If your Swan pushes go through the built-in service, you no longer need your own
Swan.ackPushDelivered/Swan.ackPushDeliveredColdStartcalls, and keeping them does not count a delivery twice. If your ownFirebaseMessagingServicedisplays Swan pushes, keep those calls: the SDK never sees those pushes.
- If your Swan pushes go through the built-in service, you no longer need your own
- A notification is reported as clicked only when the user taps it. In 1.1.3, if the SDK was already initialized when a push arrived, the push was reported as clicked as soon as it was shown, and
addNotificationOpenedListener/addDeepLinkOpenedListenerfired at that moment. If no listener was registered yet, they fired as soon as one was, which could open the push's deep link without a tap. Because the setup guide initializes Swan inApplication.onCreate, this covered pushes arriving in the foreground, in the background, or while the app was closed. A real tap within 30 seconds was then ignored, and a later tap counted as a second click. Showing a notification no longer counts as a click or calls those listeners; tapping it does. Silent pushes that arrived while the app was running could also be reported as clicked; they no longer are.- What changes for you: expect Android click counts and click-through rates to drop to real taps, and push-click journeys to start only on real taps. Clicks are reported by
Swan.handleNotificationIntent(intent), so call it in your launch activity'sonCreateandonNewIntent. Without theonNewIntentcall, taps while your app is already open are not reported. To react to a push when it arrives, useaddPushNotificationReceivedListener.
- What changes for you: expect Android click counts and click-through rates to drop to real taps, and push-click journeys to start only on real taps. Clicks are reported by
- A login the server could not complete no longer leaves the device half signed in. When the server accepted a
login()/identify()call but could not complete it, the SDK still saved the new customer's identifier without switching to that customer's profile. The device then reported the new identifier while events kept going to the profile it had before: the anonymous profile, or the previously signed-in customer. If the device had been anonymous, a laterlogout()did nothing, so the server was never told the customer had signed out. A login the server reports as failed now leaves the device's identity exactly as it was, the same as when the device is offline; callinglogin()/identify()again retries it. - Events now report the SDK version your app actually ships. Android SDK releases 1.0.0 through 1.1.3 all sent the same fixed version,
2.7.3, so your data couldn't show which Android SDK build a device was running. Events, login, logout and push-registration calls now carry the real SDK version (1.1.4for this release). Android data from earlier releases still shows2.7.3.
[android/1.1.3] — 2026-09-22
Artifact: cx.swan:swan-android-sdk:1.1.3 on Maven Central
Min SDK: 21 (Android 5.0) · Target/Compile SDK: 34 · Kotlin: 2.0.21 · AGP: 8.7
Fixed
- Profile updates now always apply to the customer who was active when the update was made.
enrichProfile()is queued and sent in the background; previously, if a login or logout happened — or the send was retried — before the queue flushed, the update could be written against the wrong customer. Each queued update now carries the customer it was made for and is always applied to that customer.
[android/1.1.2] — 2026-08-18
Artifact: cx.swan:swan-android-sdk:1.1.2 on Maven Central
Min SDK: 21 (Android 5.0) · Target/Compile SDK: 34 · Kotlin: 2.0.21 · AGP: 8.7
Fixed
- Push delivery and click receipts are now reported reliably. Previously, if the device was briefly offline the moment a push arrived — most often when the app had been force-closed — the delivery or click receipt could be lost, under-counting delivery and engagement. Receipts are now saved on the device as soon as a push is handled and are automatically retried the next time the app launches or returns to the foreground. Unsent receipts are retained for up to 7 days.
- Push notifications are no longer delayed by receipt reporting. Sending a delivery receipt no longer blocks the notification from being displayed, so a slow or unreachable network can no longer hold up the push.
[android/1.1.1] — 2026-06-25
Artifact: cx.swan:swan-android-sdk:1.1.1 on Maven Central
Min SDK: 21 (Android 5.0) · Target/Compile SDK: 34 · Kotlin: 2.0.21 · AGP: 8.7
Changed
- Device registration resolves the device identifier more robustly. The SDK now reliably obtains the device identifier when registering, so the identifier is consistently available for events and attribution.
[android/1.1.0] — 2026-06-19
Artifact: cx.swan:swan-android-sdk:1.1.0 on Maven Central
Min SDK: 21 (Android 5.0) · Target/Compile SDK: 34 · Kotlin: 2.0.21 · AGP: 8.7
Fixed
Swan.login()now triggers the full backend pipeline. Previously alogin()call suppressed the backend's downstream side-effects (cart, journey, and messaging triggers) in the same wayidentify()does.login()now runs the complete pipeline, so logging a user in fires those side-effects as expected.identify()is unchanged and continues to switch the profile without those side-effects.- Carousel notification text is now readable on dark notification shades. Carousel push notifications previously used hardcoded dark text that became unreadable when the OS drew the notification shade in dark mode; the text now adapts to the light or dark shade.
- Logging out now starts a fresh anonymous identity. When a user who first used the app anonymously and later signed in subsequently logs out, the SDK begins a new anonymous identity instead of reusing the one that had been merged into their account on sign-in. This prevents activity after logout from being attributed to the signed-out user.
[android/1.0.0] — 2026-05-16
First production release of the Swan Android SDK.
Artifact: cx.swan:swan-android-sdk:1.0.0 on Maven Central
Min SDK: 21 (Android 5.0) · Target/Compile SDK: 34 · Kotlin: 2.0.21 · AGP: 8.7
Added
- Core identity —
Swan.init,Swan.identify,Swan.login,Swan.logout,Swan.enrichProfile,Swan.getSwanIdentifier,Swan.getDeviceInfo. Anonymous-to-identified profile merge on the backend. - Event tracking —
SwanEvents.screen,Swan.customEvent,Swan.track, super-properties (setCountry/setCurrency/setBusinessUnit/setCurrentScreenName), session tracking with 20-minute inactivity rollover, offline-first SQLite-backed queue with exponential-backoff retry. - E-commerce events — typed helpers covering
productViewed,productAddedToAddTocart,productAddedToWishlist,checkoutStarted,checkoutCompleted,orderCompleted,search,categoryViewedPage, and the rest of the catalog (see the Track events guide). - Push notifications (FCM) —
SwanMessagingServiceFCM subclass, token registration and rotation, basic + carousel (manual + auto) notification templates, 5 predefined notification channels (swan_transactional,swan_alerts,swan_promotional,swan_general,swan_notifications), custom-sound channel support viaSwan.createNotificationChannel(soundResName=...), badge count, foreground / cold-start notification routing, click acknowledgement. - Deep linking —
Swan.handleDeepLink(url)for external URLs,Swan.handleNotificationIntent(intent)for cold-start,Swan.handleNotificationTap(data)for warm-start, listener model viaSwan.addNotificationOpenedListener+Swan.addDeepLinkOpenedListener, 30-second deduplication onmessageId. - Permissions —
Swan.requestNotificationPermission()(suspending),Swan.hasNotificationPermission(),Swan.isPushEnabled(), gracefulPOST_NOTIFICATIONS-denied handling on Android 13+. - Location —
Swan.updateLocation(lat, lng, accuracy?),Swan.isLocationEnabled(). Host app supplies coordinates; the SDK does not acquire location itself. - Lifecycle listeners —
addInitializedListener,addDeviceRegisteredListener,addDeviceRegistrationFailedListener,addSwanIdentifierChangedListener,addNetworkStateChangedListener,addPushTokenRegisteredListener,addPushTokenRegistrationFailedListener,addPushNotificationReceivedListener,addPushTokenRefreshListener,addNotificationOpenedListener,addDeepLinkOpenedListener,addPushLifecycleListener. - Log markers — six
[SwanSDK] *log lines emit at key lifecycle points (init start, init done, device registered, foreground push received, notification displayed, notification ACK queued) for integration verification.