OneSignal Flutter SDK Version 3 - Beta!
Hello everyone! The Flutter major release version 3 is now in Beta!
This version includes many exciting changes including an overall simplification of the API as well as many of the underlying native improvements and bug fixes.
Some key changes already in Beta:
- Better notification control while app is in foreground
- Part of OneSignal initialization is now done for you automatically. Simply set the app id to complete the process.
Why you should start migrating now
Most importantly, we want to give you the opportunity to voice your opinion and provide feedback so that we can make changes as needed to better suit your implementation.
Furthermore, it is always beneficial to get a head start on migrating your implementation to ensure a smooth transition. As we continue improving OneSignal, being fully migrated to the latest version of the SDK will help minimize potential issues and ensure you can focus on providing value to your customers, improving your business, and creating a delightful messaging experience.
To begin migrating your app to version 3, read our migration guide here. Regarding this guide, please let us know if anything could be clarified or communicated better.
We are looking forward to hearing from you.
Enjoy!
Is Null Safety included ?
Is Null Safety included ?
dart pub outdated --mode=null-safety
says no
:-(
After following the migration guide, I am getting the following
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
OneSignalNotificationServiceExtension/NotificationService.m:1:9: fatal error: 'OneSignal/OneSignal.h' file not found
#import <OneSignal/OneSignal.h>
^~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Is there an updated version of NotificationService.m to use?
EDIT: I believe I was just missing pod 'OneSignal', '>= 3.0.0', '< 4.0' from the Runner target in my Podfile, I think it's working now. Will report back any issues if I encounter them.
@Jeasmine OneSignal.shared.setNotificationOpenedHandler((OSNotificationOpenedResult result) {} is not triggered. It works in version 2.6.3 though.
When I click on the push notification, setNotificationOpenedHandler should be called
OneSignal.shared.setNotificationOpenedHandler((OSNotificationOpenedResult result) {
try {
ReceiveNotification.instance.addPushData(result.notification);
}
catch(e) {
print('e : ' + e.toString());
}
});
Unfortunately, this does not happen and I get the error below
I/WM-WorkerWrapper( 7882): Worker result FAILURE for Work [ id=eacb68a2-f7f4-4dd6-9be0-785162b87877, tags={ com.onesignal.OSNotificationRestoreWorkManager$NotificationRestoreWorker } ]
W/OneSignal( 7882): FusedLocationApi.requestLocationUpdates failed!
W/OneSignal( 7882): java.lang.NullPointerException: Calling thread must be a prepared Looper thread.
W/OneSignal( 7882): at com.google.android.gms.common.internal.Preconditions.checkNotNull(Unknown Source)
W/OneSignal( 7882): at com.google.android.gms.internal.location.zzq.requestLocationUpdates(Unknown Source)
W/OneSignal( 7882): at com.onesignal.GMSLocationController$FusedLocationApiWrapper.requestLocationUpdates(GMSLocationController.java:198)
W/OneSignal( 7882): at com.onesignal.GMSLocationController$LocationUpdateListener.init(GMSLocationController.java:181)
W/OneSignal( 7882): at com.onesignal.GMSLocationController$LocationUpdateListener.<init>(GMSLocationController.java:165)
W/OneSignal( 7882): at com.onesignal.GMSLocationController.onFocusChange(GMSLocationController.java:117)
W/OneSignal( 7882): at com.onesignal.LocationController.onFocusChange(LocationController.java:326)
W/OneSignal( 7882): at com.onesignal.OneSignal.onAppLostFocus(OneSignal.java:1203)
W/OneSignal( 7882): at com.onesignal.ActivityLifecycleHandler$AppFocusRunnable.run(ActivityLifecycleHandler.java:282)
W/OneSignal( 7882): at java.lang.Thread.run(Thread.java:762)
Same issues was fixed on OneSignal Android SDK - notifications omitted in OSRemoteNotificationReceivedHandler and from disabled channels being restored and shown as silent notifications. PR #1289, Issue #1265
@Jeasmine OneSignal.shared.setNotificationOpenedHandler((OSNotificationOpenedResult result) {} is not triggered. It works in version 2.6.3 though.
Thanks for the feedback. Is it not working for both Android and iOS?
@Jeasmine Only Android. unfortunately this bug is blocking me from releasing an application update. Please, solve it as soon as possible
@Jeasmine OneSignal.shared.setNotificationOpenedHandler((OSNotificationOpenedResult result) {} is not triggered. It works in version 2.6.3 though.
Thanks for the feedback. Is it not working for both Android and iOS?
Yes, it does not work for both Android and iOS.
@Jeasmine Any update with beta-1 ? I need a fix for this problem fairly quickly as it prevents me from the released versions. Unfortunately, I can't revert my project to the previous version.
@MeAtPros, we are working on the new release, hopefully, will be out this week
@MeAtPros there is this PR up https://github.com/OneSignal/OneSignal-Flutter-SDK/pull/375, but unfortunately, the scenario when the app is swiped away the open handler is not being called, there is a problem with flutter integration still trying to figure it out.
@Jeasmine I'm looking for this release too, the beta release solves a critical problem in iOS that in version 2 I can't suppress default launch url behavior to only handle inside my app, and the version 3 helped me to do this :)
Same having issues with launch url, we're unable to deep link into our app with the launch_url parameter
After migrating we are having the problem in #374 which is preventing us from distributing the app.
I am having the same problem as #374. I tried reverting OneSignal to 2.6.3 but I still get the same errors...
@Jeasmine @mikechoch @mpillar Can you set a date when a proper release of the update can be expected?
Beta 2 has been released! https://github.com/OneSignal/OneSignal-Flutter-SDK/releases/tag/3.0.0-beta2
Hi, the issue with the external user id being randomly set when using setExternalUserId is still there.
@gilthonweapps, Could you open a GitHub issue with the steps to reproduce and the description, or could you point me out to the issue if there is already one created? Thanks!