Closed Danielku15 closed 3 weeks ago
NOTE: Another usecase for this change can be a real change of the users from an old to a new app. as part of a software update you might change the AppKey and as people upgrade they should be migrated to the new app.
NOTE2: The iOS SDK has the same behavior https://github.com/Notificare/notificare-sdk-ios/blob/main/NotificareKit/Sources/Internals/Modules/NotificareDeviceModuleImpl.swift#L710
Hi @Danielku15,
This behaviour is intended by design. It helps prevent side effects when developers make mistakes when changing their keys. What you're proposing is a feature request. We should move this discussion to our support portal so you can share more details about your project. Can you message our support channel?
I've sent out a message describing all our needs and what concrete changes we would need from the SDKs to be able to use Notificare for our future push notification needs.
Is there an existing issue for this?
Describe the bug
We have a multi-tenancy app where the mobile app registers to different apps in the backend. This is done by configuring notificare with AppKey/AppSecret matching the tenant.
When a user switches the tenant, the device doesn't register to the new tenant. When login to a new tenant (changed app key) the device registration is skipped and the launch fails with a 404 when loading the inbox:
https://github.com/Notificare/notificare-sdk-android/blob/f756ff63b5930360bbb43dafcb29dde61b37cb11/notificare/src/main/java/re/notifica/internal/modules/NotificareDeviceModuleImpl.kt#L343-L344 https://github.com/Notificare/notificare-sdk-android/blob/f756ff63b5930360bbb43dafcb29dde61b37cb11/notificare/src/main/java/re/notifica/internal/modules/NotificareDeviceModuleImpl.kt#L389-L458
If the AppKey for the app changed since the last launch, the device must also register newly (any maybe optionally unregister from the old one?)
Steps to reproduce
<meta-data android:name="re.notifica.auto_configuration_enabled" android:value="false"/>
in your manifest.Notificare.configure(context, "AppKey1", "AppSecret1")
andNotificare.launch()
Notificare.configure(context, "AppKey2", "AppSecret2")
andNotificare.launch()
Expected behaviour
The SDK should detect a change in app keys. It first should attempt deleting the registration on the old app it had before. And then it should register freshly in the new app.
It would also be fine for me if we can set somehow the device information before any registration starts. To force a re-registration. e.g. the currentDevice.userId. But
Notificare.device().register(...)
requires the SDK to already be initialized successfully.Relevant log output
Library version
3.10.0
Operating system
Android 14
Smartphone model
Google Pixel 6 Pro
Additional context