Today we’re proud to announce that our major versions of the OneSignal iOS and Android SDKs are out of beta!

With this version we’ve refined our SDK to be more straightforward for common use cases while providing more flexibility for advanced ones. Better defaults and removing deprecated APIs means less code is required to set up notifications and options are more relevant.

What Does This Mean for You?

Covered in our blog post back in September during the beta release of these SDKs, OneSignal users who migrate to the new API will have access to:

More Dynamic Initialization:

For Android, we’ve brought the OneSignal appId configuration out of the build.gradle and into the API via the setAppId method. Initialization is now a two step process requiring both init and setAppId to be called. setAppId can now be called at any point in your app’s flow.

On iOS, initialization in version 3 is also now a two step process that requires both initWithLaunchOptions and setAppId You can now call setAppId at any point in your app’s flow.

Both of these changes allow for full initialization to be delayed until, say, a user logs in.

Foreground Notification Control:

You can now specifically read notification data that will display while the app is in focus as well as change the display type dynamically! This allows developers to have even greater control over someone’s experience when receiving notifications.

This change was made based on user feedback and is extremely useful when you don’t want to interrupt your users by displaying push notifications at inopportune times. For more information, check out our documentation on “Android - Foreground Notification Control” and iOS Foreground Notification Control”!

Better Android Project Compatibility with AndroidX

OneSignal has now been fully updated to use AndroidX, which means you no longer need to enable Google Jetifier to run with your build process.

Complete List of Changes

There’s many more upgrades that we’ve made to our SDKs that you can check out on our Mobile SDKs API Migration Guides! Take a look at all the great stuff we’ve shipped to help make the lives of our API users even easier.

How Do I Setup the Upgraded SDK?

Setting up OneSignal for the first time? Follow the guides below to get started.

For existing OneSignal apps, see the following:

Android:

  1. Update the SDK version range in your app/build.gradle.

2.   Switch to the new initialization in your Application class

3.  Depending on your specific setup, there may be other changes you have to make. See our Step by Step Android Native 3.x to 4.0.0 Upgrade Guide for more information.

iOS:

  1. Update the SDK version range in your Podfile:

Note: If you are using SwiftPM use the new 3.0.0 branch instead.

2.   Switch to the new initialization in your AppDelegate

3.   Similar to our Android SDK, depending on your specific setup there may be more changes you have to make. See our Step by Step iOS Native 2.x to 3.0.0 Upgrade Guide for more information.

Other Mobile SDKs

If you are using React Native(in Beta), Cordova, Flutter, Unity, or Xamarin stay tuned for updates as these get rolled out with the same changes over the next few months.

Let Us Know How We Can Improve Our SDK!

We’re always looking to improve! Please reach out on Github by creating a new issue with any feedback you have or if you run into any issues while upgrading.