You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MIGRATION_GUIDE.md
+30-2Lines changed: 30 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -149,6 +149,34 @@ To resume receiving of push notifications (driving the native permission prompt
149
149
150
150
pushSubscription.optIn()
151
151
152
+
To observe changes to the push subscription a class can implement the IPushSubscriptionObserver interface, and can then be added as an observer:
153
+
154
+
**Java**
155
+
156
+
@Override
157
+
public void onPushSubscriptionChange(@NonNull PushSubscriptionChangedState state) {
158
+
...
159
+
}
160
+
161
+
pushSubscription.addObserver(this);
162
+
163
+
**Kotlin**
164
+
165
+
override fun onPushSubscriptionChange(state: PushSubscriptionChangedState) {
166
+
...
167
+
}
168
+
169
+
pushSubscription.addObserver(this)
170
+
171
+
If you would like to stop observing the subscription you can remove the observer:
172
+
173
+
**Java**
174
+
175
+
pushSubscription.removeObserver(this);
176
+
177
+
**Kotlin**
178
+
179
+
pushSubscription.removeObserver(this)
152
180
153
181
**Email/SMS Subscriptions**
154
182
Email and/or SMS subscriptions can be added or removed via:
@@ -186,12 +214,12 @@ The OneSignal SDK has been rewritten in Kotlin. This is typically transparent to
186
214
In Java this is surfaced on a method via an additional parameter to the method of type `Continuation`. The `Continuation` is a callback mechanism which allows a Java function to gain control when execution has resumed. If this concept is newer to your application codebase, OneSignal provides an optional java helper class to facilitate the callback model. Method `com.onesignal.Continue.none()` can be used to indicate no callback is necessary:
`com.onesignal.Continue.with()` can be used to create a callback lambda expression, which is passed a `ContinueResult` containing information on the success of the underlying coroutine, it's return data, and/or the exception that was thrown:
0 commit comments