Migration guide
This guide refers to migration from the deprecated SDK versions to newer
Migration from Android SDK 5 to 6
Migrate your project to AndroidX according to the official documentation.
Add a new module in the app's build.gradle file if you are using Firebase Cloud Messaging.
For those who use Amazon or Baidu, and do not use Firebase, no changes needed.
Migration from previous versions of Android SDK
Most of Pushwoosh classes and methods became deprecated since 5.0 release and some of them became extinct. PushManager, BasePushMessageReceiver, BaseRegistrationReceiver, SendPushTagsCallback, PushFragment and PushEventListener classes are still available as part of com.pushwoosh:pushwoosh-deprecated
library but it is recommended to migrate to new API as soon as possible.
PushManager
PushManager consisted of various methods for different features. These methods are now split between different classes and libraries:
com.pushwoosh:pushwoosh
: Pushwoosh, PushwooshNotificationSettings, PushwooshInApp.
com.pushwoosh:pushwoosh-badge
: PushwooshBadge.
com.pushwoosh:pushwoosh-location
: PushwooshLocation.
com.pushwoosh:pushwoosh-beacon
: PushwooshBeacon.
BaseRegistrationReceiver
BaseRegistrationReceiver was used to handle push registration and unregistration events. This receiver is now replaced by simple callback mechanism:
BasePushMessageReceiver
BasePushMessageReceiver was used to imitate iOS notification behaviour when receiving push notification in foreground. It was achieved by cancelling incoming notification and invoking onMessageReceive callback. It was clunky and required manual registration when application becomes active and deregistration when application goes background. This receiver was replaced by NotificationServiceExtension:
This extension is also used to handle notification arrival and accept events thus replacing all clunky code that was used in manual Activity integration.
PushFragment
PushFragment was a lightweight alternative for the complex integration involving Activity lifecycle. But on the other hand it required FragmentActivity inheritance and implicitly used more complex Fragment lifecycle. PushFragment and PushEventListener are now replaced by Pushwoosh#registerForPushNotifications(Callback) and NotificationServiceExtension.
Custom Push Broadcast Receiver (PW_NOTIFICATION_RECEIVER)
PW_NOTIFICATION_RECEIVER was used to customise behaviour when user clicks on notification. This allowed to handle notifications outside of Activity context and to open different Activities depending on notification content. This integration used internal Pushwoosh SDK API which no longer exists. This receiver is now completely replaced by NotificationServiceExtension:
Notification Factory
There also were some breaking changes involving notification factory:
1. AbsNotificationFactory was replaced by NotificationFactory 2. AbsNotificationFactory#onPushReceived(PushData) and AbsNotificationFactory#onPushHandle(Activity) methods replaced by NotificationServiceExtension class (onMessageReceived, startActivityForPushMessage). 3. DefaultNotificationFactory was replaced by PushwooshNotificationFactory. 4. PushData was replaced by PushMessage.
In-App Messages
1. InAppFacade was replaced by PushwooshInApp.
2. pushwoosh
object was inroduced for JavaScript native interface with following API:
getHwid(): string - returns pushwoosh hwid for current device.
getVersion(): string - returns current pushwoosh SDK version.
postEvent(event: string, attributes?: object, successCallback?: function, errorCallback?: function) - sends postEvent request.
sendTags(tags: object) - send tags associated with current device.
getTags(successCallback: function, errorCallback?: function) - returns tags associated with current device.
closeInApp() - closes In-App html page.
Share your feedback with us
Your feedback helps us create a better experience, so we would love to hear from you if you have any issues during the SDK integration process. If you face any difficulties, please do not hesitate to share your thoughts with us via this form.
Last updated