Closed rivaros closed 1 year ago
Hi @rivaros
Thanks for reaching out.
You are correct with your assumption that in certain scenarios like yours, the device is not get registered as expected. This is happening because of lifecycle differences between react native and native modules, that means that the native methods are called before react native lifecycle starts.
I would like to let you know that our team is working on a similar issue here and we are hopeful to come up with a fix very soon.
Hi @rivaros, while we continue working on the lifecycle differences, we just pushed version 2.0.1 that gives you the flexibility to add a device token directly using the method CustomerIO.registerDeviceToken(token)
. Take a look and let us know if this unblocks you in short term. Thank you!
SDK version: 2.0.0-beta1
Environment: not relevant
Are logs available?
Describe the bug If my assumption is correct, registration of device token in CustomerIO happens in call to
MessagingPush.shared.messaging()
, below, but only if user is identified (otherwise token is not registered).If it is true, that makes a problem, because
didReceiveRegistrationToken
call from FIRMessaging delegate happens on the very app launch, when obviously user identification happens on a later stage.So even if later we call
CusromerIO.identify()
and even we can call something likefirebase.messaging().registerDeviceForRemoteMessages()
, device would be registered for notifications, but methoddidReceiveRegistrationToken
will not be triggered again (as FCM and APN tokens were generated on app start) So device would not be added to user account in customerio.To Reproduce Basically any scenario where
didReceiveRegistrationToken
happens on launch, andCustomerIO.identify(
on later stageExpected behavior There should be some check on
CusromerIO.identify()
: if FCM token received & device is registered for remote notification, SDK should detect and add the token to CustomerIOScreenshots N/A
Additional context N/A