Today we’re excited to announce the release of version 3 of our Flutter SDK!
We’ve updated our Flutter SDK package to be compatible with Flutter 2.2, which leverages Flutter’s null safety feature to improve the reliability of your app. We’ve also updated the SDK to work alongside our latest mobile SDKs: Android version 4.4.0 and iOS version 3.4.4.
Major Release Improvements
We’ve added support for SMS to allow for more advanced multi-channel messaging across push, email, and now SMS. We now support associating a device with an SMS number by calling setSMSNumber, which enables you to set and update phone numbers. This empowers multi-channel communication with your customers across web and mobile push, email, and SMS.
To associate multiple devices to the same user, you will need to set an External User Id.
The same way we can listen to email and push subscription changes, now setSMSSubscriptionObserver is available for SMS subscription updates.
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 initWithContext 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.
These changes allow you to get up and running with Flutter faster than ever, as the developer only needs to call setAppId. This is a more straightforward configuration, as default behaviors are handled by the SDK and require less configuration from the developer. On the SDK side, we’ve improved performance by executing processes on a background thread, which should improve the responsiveness of your app’s UI.
Foreground Notification Control
You can now specifically read notification data that will display while the app is in focus and change the display type dynamically. As a result of user feedback and requests, we’ve made this update to provide developers even greater control over someone’s experience when receiving notifications. This can be extremely useful when you don’t want to interrupt your users by displaying push notifications at inopportune times -- while a user is in the middle of game play, for example.
Better Android Project Compatibility with AndroidX
OneSignal now supports AndroidX, which means you no longer need to enable Google Jetifier to run with your build process.
You can learn more about what else changed in our Flutter - 3.0 API Reference.
How Do I Migrate to the New SDK?
If you’re setting up OneSignal for the first time, follow the Flutter SDK 3.0 Setup guide below to get started.
For existing OneSignal apps, refer to Migrating from Flutter 2.x to 3.x.
Let Us Know How We Can Improve Our SDK!
We take developer feedback seriously, and we’re always looking to improve. Please reach out to our team on Github by creating a new issue with any feedback you have or if you run into any problems while upgrading.