Closed PauchardThomas closed 5 years ago
@PauchardThomas Calling SetSubscription(bool)
is not an instantaneous method, it triggers an HTTP request that updates our backend servers. Because of this, it can take some time before calling SetSubscription(false)
actually disables push notifications. And if the user has a flaky/slow/poor internet connection, there can be even more problems.
If you want to guarantee with absolute certainty that no notification can ever be received instantaneously after disabling push notifications, you would need to implement the Notification Service Extension/Notification Extender Service in native code (ObjC/Swift and Java/Kotlin) so that you can manually stop showing notifications if they are disabled locally.
@Nightsd01 Thank you, it's now clearer !
Btw, I don't have any idea how to implement the Notification Service extension for both android and ios. I'm not used to manipulate push notifications services ... Do you have any suggestions?
Thank you for your time.
@PauchardThomas I did some more research into this, and unfortunately my initial suggestion will work for Android but not for iOS. There is literally no way to cancel a notification in iOS once it has been received, even using the Extension Service.
You could also build out a custom solution using silent notifications to schedule local notifications, but that would be completely unsupported by our SDK unfortunately.
That said, this would not be a super common issue and I would recommend you put your time into more impactful things as it's unlikely most of your users will ever see this situation.
Description:
Hi I'm using OneSignal xamarin SDK. I having an issue on my app ( chat app):
1- I lock my screen when my app is open(Iphone X). 2- Onsleep method called : enable push OneSignal.Current.SetSubscription(true); 3- Sending push from server to the app 3- App : Receving the push. 4- Open it from the lock screen 5- OnResume method called: disable push: OneSignal.Current.SetSubscription(false); 6- Sending push from server to the app 7a- Push not received. 👍
8- Repeat theses steps ~ 5 times.
6- Sending push from server to the app 7b- I received the push while I disable it on the OnResume method. 👎
Any idea?
Environment
XF : 3.3.0 OneSignal xamarin sdk (NuGet) 3.2.2