Today our next major versions of the OneSignal iOS and Android SDKs are available in beta.
This version provides simpler yet more flexible initialization, foreground notification control, upgrades to AndroidX, Swift and Kotlin nullability, and more. Since this is a major semantic version increase we have dropped deprecated APIs so make sure to check out the details below on how to migrate to the new API.
What Does This Mean for You?
More Dynamic Initialization
Setting the OneSignal app id, notification handler, and other attributes can now occur independently of the OneSignal.init call. This means you can split these up to other parts of your code based on your app requirements.
Foreground Notification Control
Based on user feedback, we’ve added a new notificationWillShowInForeground API enabling you to decide if the specific notification you’re about to show should be when your app is in the foreground.
This is useful when you don’t want to interrupt your users by displaying a push notification at an inopportune time, whether they’re in the middle of an intense battle in your game, or interrupting an ongoing conversation while the user is already in your chat app. See "Android - Foreground Notification Control" and "iOS - Foreground Notification Control" for more details on this new API.
Better Android Project Compatibility with AndroidX
The internals of OneSignal have been updated to use AndroidX. This means you no longer need to enable Google Jetifier to run with your build process.
Complete List of All Changes
See our Mobile SDKs API Migration Guides page for a list of all other changes.
What SDKs Are Available in This Beta?
Native iOS and Android developers can try out the betas today! Unity, React Native, and our other wrapper SDKs are becoming available as we roll them out over the coming weeks.
How to Get the Beta SDK?
If you are setting up OneSignal for the first time in your app you can follow these guides
For existing OneSignal apps see the following:
- Update the SDK version range in your app/build.gradle.
2. Switch to the new initialization in your Application class
3. See the Step-by-Step Android Native 3.x to 4.0.0 Upgrade Guide on other changes you may have to make depending on your specific setup.
- Update the SDK version range in your Podfile
If you are using SwiftPM instead use the new 3.0.0-beta1 branch.
2. Switch to the new initialization in your AppDelegate
3. See the Step-by-Step iOS Native 2.x to 3.0.0 Upgrade Guide on other changes you may have to make depending on your specific setup.
Let Us Know How We Can Improve Our SDK!
Please reach out on Github by creating a new issue with any feedback you have or if you run into any issues upgrading.