This issue replaces #15586 with a new approach. We now understand the situation better and have come to a different conclusion. Summarized, I think this should be our strategy:
deviceId generation to be Leanplum.setDeviceId(randomUUID().toString())This is exactly what we had before #13230 where we thought creating a new UUID on every cold start was a bad idea. But that assumption was wrong - the Leanplum SDK will ignore new DeviceIDs once they have been set. We verified this in the SDK code.
Leanplum.setDeviceId(randomUUID().toString())This will work properly for new installs and migrated installs:
Leanplum.getDeviceId() as the source of truthuid check we do in the DeepLinkValidator (how this all started)Fortunately these changes actually _simplify_ things a lot and are much more about code removing and relying on the Leanplum SDK as the source of truth.
There is a lot of context in the following issues:
Testing results:
I did the following two times:
inadb logcat | grep LeanplumCloudMessagingProvider` and observe the _push token_ in that message.It consistently shows the same push and deviceId identifiers.
I did the following two times:
inadb logcat | grep LeanplumCloudMessagingProvider` and observe the _push token_ in that message.It consistently shows the same push token and a new Leanplum deviceId. (Assuming the push token is connected to some app/device combination, so I assume that is correct - and also out of our control)
inadb logcat | grep LeanplumCloudMessagingProvider` and observe the _push token_ in that message.adb shell into (rooted) device and see if the deviceId matches the value in /data/data/org.mozilla.fenix/shared_prefs/org.mozilla.firefox_beta/org.mozilla.gecko.BrowserApp.xmlfenix-beta://open?url=https://www.mozilla.org&uid={{User ID}}The leanplum device id was properly migrated over from Fennec.
inadb logcat | grep LeanplumCloudMessagingProvider` and observe the _push token_ in that message.fenix-beta://open?url=https://www.mozilla.org&uid={{User ID}}Push notification with deep link works: it arrives and tapping it opens Fenix Beta and opens the right link
(Also confirmed that the above steps do not work with Fenix Beta 82.0.0-beta.2.)
Since this all looks pretty good - I've added this patch to the uplift plan.
Hi, I've just checked this on 82.0.0-beta.3 using a Google Pixel 3a (Android 11)
► Leanplum
Device ID: c360efbf-61bb-4739-8ed9-9cda6ade1cc2
Android push token: ccuQxEcLKro:APA91bE2OGyMEJz2nzkUVhzUO4ulisHQ_0wz3TPeoOczzxe5fz-BwtBbhGO9A0PN7dfJnn7tJUeLft0c2XtQk4EFFaf35GSaCaFvkJYwYiuNzZB2Pz9vXxvqCUcmT8Ro4VaW9RS7rikI

► Log after running adb: logcat | findstr LeanplumCloudMessagingProvider
10-05 11:22:29.077 15703 15703 I [INFO][Leanplum]: [com.leanplum.LeanplumCloudMessagingProvider::onRegistrationIdReceived::3]: Device registered for push notifications with registration token, ccuQxEcLKro:APA91bE2OGyMEJz2nzkUVhzUO4ulisHQ_0wz3TPeoOczzxe5fz-BwtBbhGO9A0PN7dfJnn7tJUeLft0c2XtQk4EFFaf35GSaCaFvkJYwYiuNzZB2Pz9vXxvqCUcmT8Ro4VaW9RS7rikI
10-05 11:22:29.088 15703 15856 I [INFO][Leanplum]: [com.leanplum.LeanplumCloudMessagingProvider::onRegistrationIdReceived::3]: Device registered for push notifications with registration token, ccuQxEcLKro:APA91bE2OGyMEJz2nzkUVhzUO4ulisHQ_0wz3TPeoOczzxe5fz-BwtBbhGO9A0PN7dfJnn7tJUeLft0c2XtQk4EFFaf35GSaCaFvkJYwYiuNzZB2Pz9vXxvqCUcmT8Ro4VaW9RS7rikI
► Leanplum
Device ID: c360efbf-61bb-4739-8ed9-9cda6ade1cc2
Android push token: ccuQxEcLKro:APA91bE2OGyMEJz2nzkUVhzUO4ulisHQ_0wz3TPeoOczzxe5fz-BwtBbhGO9A0PN7dfJnn7tJUeLft0c2XtQk4EFFaf35GSaCaFvkJYwYiuNzZB2Pz9vXxvqCUcmT8Ro4VaW9RS7rikI

► Log after running adb: logcat | findstr LeanplumCloudMessagingProvider
10-05 11:39:30.516 16958 16958 I [INFO][Leanplum]: [com.leanplum.LeanplumCloudMessagingProvider::onRegistrationIdReceived::3]: Device registered for push notifications with registration token, ccuQxEcLKro:APA91bE2OGyMEJz2nzkUVhzUO4ulisHQ_0wz3TPeoOczzxe5fz-BwtBbhGO9A0PN7dfJnn7tJUeLft0c2XtQk4EFFaf35GSaCaFvkJYwYiuNzZB2Pz9vXxvqCUcmT8Ro4VaW9RS7rikI
✔️ Consistently shows the same push token and device ID identifiers.
► Leanplum
Device ID: ffebba05-938e-48ff-b157-0ac70a5329ee
Android push token: cSUyyUnMO4I:APA91bGH9iXe2DTAJuh0tqN2HyZeK9gV-D0L6G59ZDFEcxmjkmqnVXYI6CbQ9N4Jaj3rZUUqPAnBOyZ_VKExBt3E8666wj5eDD9yg9O466O0VugKHL2oxmtY-WM7Tzufr0NB35c_LvYM

► Log after running adb: logcat | findstr LeanplumCloudMessagingProvider
10-05 11:57:51.916 18096 18096 I [INFO][Leanplum]: [com.leanplum.LeanplumCloudMessagingProvider::onRegistrationIdReceived::3]: Device registered for push notifications with registration token, cSUyyUnMO4I:APA91bGH9iXe2DTAJuh0tqN2HyZeK9gV-D0L6G59ZDFEcxmjkmqnVXYI6CbQ9N4Jaj3rZUUqPAnBOyZ_VKExBt3E8666wj5eDD9yg9O466O0VugKHL2oxmtY-WM7Tzufr0NB35c_LvYM
10-05 11:57:51.924 18096 18265 I [INFO][Leanplum]: [com.leanplum.LeanplumCloudMessagingProvider::onRegistrationIdReceived::3]: Device registered for push notifications with registration token, cSUyyUnMO4I:APA91bGH9iXe2DTAJuh0tqN2HyZeK9gV-D0L6G59ZDFEcxmjkmqnVXYI6CbQ9N4Jaj3rZUUqPAnBOyZ_VKExBt3E8666wj5eDD9yg9O466O0VugKHL2oxmtY-WM7Tzufr0NB35c_LvYM
► Leanplum
Device ID: 0e309c95-6eea-4d47-b8d5-a16c124a01bb
Android push token: eR8XwX68Eb8:APA91bEwUGP97lmVkgEQvx2Jhvi3UkNtoogV5G268igogP57Dq881SI2z4UACxlHrP92h-zGB-EXPh2HbCDLEmgkqpC9flrdC6eHIEBTfjizilHAzyt5FSjpI12Ur4ZPCYTFIeswRWEU

► Log after running adb: logcat | findstr LeanplumCloudMessagingProvider
10-05 12:07:30.767 18984 19163 I [INFO][Leanplum]: [com.leanplum.LeanplumCloudMessagingProvider::onRegistrationIdReceived::3]: Device registered for push notifications with registration token, eR8XwX68Eb8:APA91bEwUGP97lmVkgEQvx2Jhvi3UkNtoogV5G268igogP57Dq881SI2z4UACxlHrP92h-zGB-EXPh2HbCDLEmgkqpC9flrdC6eHIEBTfjizilHAzyt5FSjpI12Ur4ZPCYTFIeswRWEU
10-05 12:07:30.774 18984 18984 I [INFO][Leanplum]: [com.leanplum.LeanplumCloudMessagingProvider::onRegistrationIdReceived::3]: Device registered for push notifications with registration token, eR8XwX68Eb8:APA91bEwUGP97lmVkgEQvx2Jhvi3UkNtoogV5G268igogP57Dq881SI2z4UACxlHrP92h-zGB-EXPh2HbCDLEmgkqpC9flrdC6eHIEBTfjizilHAzyt5FSjpI12Ur4ZPCYTFIeswRWEU
✔️ A new device ID and push token are generated and assigned after reinstalling Firefox Beta
► Leanplum
Device ID: ccddf528-eb11-455a-9c34-0ad76424601e
Android push token: APA91bGT8kB2ahLCZ55ziqs-GV8R7frPnm_3EqM-HQeCjW9qbTOoKgJiXKPmHOFwjBRWsjszHbntQyLAGeXhRsSBjuXtnZTuT-5KyIEK1B2HO29UL6M0JXdXWZ7GneinKP-EL_1etprHJ1QOGVu3wMIYLeQSGUhrtg

► About:config
Device ID:ccddf528-eb11-455a-9c34-0ad76424601e

► Leanplum
Device ID: ccddf528-eb11-455a-9c34-0ad76424601e
❔ Android push token: cQfGwa2M3oc:APA91bGJa5RkCVP45xDDOhA3nh7uVydtf3OJ7sGwAW_mr2wuILeAzLNL4OMk34rzx_8M72sjDrQViNiC28JrvhNvzx3p1qN4cn740T1GwHEIyn-6fW0fHtvbb22wUd8XC-yHeAbLmb2Y
► Log after running adb: logcat | findstr LeanplumCloudMessagingProvider
✔️ 10-05 12:50:03.151 23925 24082 I [INFO][Leanplum]:
[com.leanplum.LeanplumCloudMessagingProvider::onRegistrationIdReceived::3]: Device registered for push notifications with registration token, cQfGwa2M3oc:APA91bGJa5RkCVP45xDDOhA3nh7uVydtf3OJ7sGwAW_mr2wuILeAzLNL4OMk34rzx_8M72sjDrQViNiC28JrvhNvzx3p1qN4cn740T1GwHEIyn-6fW0fHtvbb22wUd8XC-yHeAbLmb2Y
❔ 10-05 12:50:05.591 23925 24082 I [INFO][Leanplum]: [com.leanplum.LeanplumCloudMessagingProvider::onRegistrationIdReceived::3]: Device registered for push notifications with registration token, dfE4oI5e7hk:APA91bFbigGVQdFL5RhtrhQoCGWAc-5YVsmgagQROcypF-w6qF-i-Btva2rAco4kF-iro8r01-7_Maiq_3DPIjjVmS86OZr1mgFIE9BflmC2sIU5QM_DgolPGLFPYfTAdfaLPLUw6RE5
► ❔ Force closed Firefox Beta 82.0.0-beta.3 and re-run adb: logcat | findstr LeanplumCloudMessagingProvider and resulted in the following log:
10-05 12:58:35.255 24776 24776 I [INFO][Leanplum]: [com.leanplum.LeanplumCloudMessagingProvider::onRegistrationIdReceived::3]: Device registered for push notifications with registration token, dfE4oI5e7hk:APA91bFbigGVQdFL5RhtrhQoCGWAc-5YVsmgagQROcypF-w6qF-i-Btva2rAco4kF-iro8r01-7_Maiq_3DPIjjVmS86OZr1mgFIE9BflmC2sIU5QM_DgolPGLFPYfTAdfaLPLUw6RE5
► Re-checked on Leanplum
✔️ Device ID: ccddf528-eb11-455a-9c34-0ad76424601e
❔ Android push token: dfE4oI5e7hk:APA91bFbigGVQdFL5RhtrhQoCGWAc-5YVsmgagQROcypF-w6qF-i-Btva2rAco4kF-iro8r01-7_Maiq_3DPIjjVmS86OZr1mgFIE9BflmC2sIU5QM_DgolPGLFPYfTAdfaLPLUw6RE5

✔️ Properly sent the Push Notification VIA Leanplum based on the User ID
✔️ Received the notification and after tapping it Firefox Beta opened
► Video

✔️ The device ID was inherited from Fennec Beta
✔️ Properly sent and received the push notification.
✔️ Tapping it opened https://www.mozilla.org
❓ The push token got changed as it follows:
Fennec : APA91bGT8kB2ahLCZ55ziqs-GV8R7frPnm_3EqM-HQeCjW9qbTOoKgJiXKPmHOFwjBRWsjszHbntQyLAGeXhRsSBjuXtnZTuT-5KyIEK1B2HO29UL6M0JXdXWZ7GneinKP-EL_1etprHJ1QOGVu3wMIYLeQSGUhrtg
▼
Right after the update the log showed 2 new push tokens:
✔️Same as per Leanplum cQfGwa2M3oc:APA91bGJa5RkCVP45xDDOhA3nh7uVydtf3OJ7sGwAW_mr2wuILeAzLNL4OMk34rzx_8M72sjDrQViNiC28JrvhNvzx3p1qN4cn740T1GwHEIyn-6fW0fHtvbb22wUd8XC-yHeAbLmb2Y
and
❔ Different than the one displayed in Leanplum dfE4oI5e7hk:APA91bFbigGVQdFL5RhtrhQoCGWAc-5YVsmgagQROcypF-w6qF-i-Btva2rAco4kF-iro8r01-7_Maiq_3DPIjjVmS86OZr1mgFIE9BflmC2sIU5QM_DgolPGLFPYfTAdfaLPLUw6RE5
▼
Force closed Firefox Beta 82.0.0-beta.3 and rechecked both the log and Leanplum and it got changed to:
✔️ dfE4oI5e7hk:APA91bFbigGVQdFL5RhtrhQoCGWAc-5YVsmgagQROcypF-w6qF-i-Btva2rAco4kF-iro8r01-7_Maiq_3DPIjjVmS86OZr1mgFIE9BflmC2sIU5QM_DgolPGLFPYfTAdfaLPLUw6RE5
@st3fan could you please review and advise? ☺️
Not sure if the push token changes after performing a migration are expected or not?
The push token changing is fine. That is expected.
Many thanks! ☺️
In this case, I'll mark this matter verified as fixed on 82.0.0-beta.3 using a Google Pixel 3a (Android 11)
Most helpful comment
Hi, I've just checked this on 82.0.0-beta.3 using a Google Pixel 3a (Android 11)
✅ 1️⃣ Leanplum persists the device identifier at cold start
• Fresh install of Firefox Beta
► Leanplum
Device ID: c360efbf-61bb-4739-8ed9-9cda6ade1cc2

Android push token:
ccuQxEcLKro:APA91bE2OGyMEJz2nzkUVhzUO4ulisHQ_0wz3TPeoOczzxe5fz-BwtBbhGO9A0PN7dfJnn7tJUeLft0c2XtQk4EFFaf35GSaCaFvkJYwYiuNzZB2Pz9vXxvqCUcmT8Ro4VaW9RS7rikI► Log after running
adb: logcat | findstr LeanplumCloudMessagingProvider• Force stop Firefox beta and re-launch it
► Leanplum
Device ID: c360efbf-61bb-4739-8ed9-9cda6ade1cc2

Android push token:
ccuQxEcLKro:APA91bE2OGyMEJz2nzkUVhzUO4ulisHQ_0wz3TPeoOczzxe5fz-BwtBbhGO9A0PN7dfJnn7tJUeLft0c2XtQk4EFFaf35GSaCaFvkJYwYiuNzZB2Pz9vXxvqCUcmT8Ro4VaW9RS7rikI► Log after running
adb: logcat | findstr LeanplumCloudMessagingProvider10-05 11:39:30.516 16958 16958 I [INFO][Leanplum]: [com.leanplum.LeanplumCloudMessagingProvider::onRegistrationIdReceived::3]: Device registered for push notifications with registration token, ccuQxEcLKro:APA91bE2OGyMEJz2nzkUVhzUO4ulisHQ_0wz3TPeoOczzxe5fz-BwtBbhGO9A0PN7dfJnn7tJUeLft0c2XtQk4EFFaf35GSaCaFvkJYwYiuNzZB2Pz9vXxvqCUcmT8Ro4VaW9RS7rikI📝Notes
✔️ Consistently shows the same push token and device ID identifiers.
✅ 2️⃣ Leanplum does not persist the device identifier between app installs
• Fresh install of Firefox Beta
► Leanplum
Device ID: ffebba05-938e-48ff-b157-0ac70a5329ee

Android push token:
cSUyyUnMO4I:APA91bGH9iXe2DTAJuh0tqN2HyZeK9gV-D0L6G59ZDFEcxmjkmqnVXYI6CbQ9N4Jaj3rZUUqPAnBOyZ_VKExBt3E8666wj5eDD9yg9O466O0VugKHL2oxmtY-WM7Tzufr0NB35c_LvYM► Log after running
adb: logcat | findstr LeanplumCloudMessagingProvider• Delete Firefox beta and Re-install it using the .apk from task index (not available yet on Play Store)
► Leanplum
Device ID: 0e309c95-6eea-4d47-b8d5-a16c124a01bb

Android push token:
eR8XwX68Eb8:APA91bEwUGP97lmVkgEQvx2Jhvi3UkNtoogV5G268igogP57Dq881SI2z4UACxlHrP92h-zGB-EXPh2HbCDLEmgkqpC9flrdC6eHIEBTfjizilHAzyt5FSjpI12Ur4ZPCYTFIeswRWEU► Log after running
adb: logcat | findstr LeanplumCloudMessagingProvider📝Notes:
✔️ A new device ID and push token are generated and assigned after reinstalling Firefox Beta
❓ 3️⃣ On a migrated device, the device identifier is inherited from the old Fennec settings
• Fresh install of Fennec Beta 68.7b1
► Leanplum
Device ID: ccddf528-eb11-455a-9c34-0ad76424601e

Android push token:
APA91bGT8kB2ahLCZ55ziqs-GV8R7frPnm_3EqM-HQeCjW9qbTOoKgJiXKPmHOFwjBRWsjszHbntQyLAGeXhRsSBjuXtnZTuT-5KyIEK1B2HO29UL6M0JXdXWZ7GneinKP-EL_1etprHJ1QOGVu3wMIYLeQSGUhrtg► About:config

Device ID:ccddf528-eb11-455a-9c34-0ad76424601e
• Upgrade to Firefox Beta 82.0.0-beta.3
► Leanplum
Device ID: ccddf528-eb11-455a-9c34-0ad76424601e
❔ Android push token:
cQfGwa2M3oc:APA91bGJa5RkCVP45xDDOhA3nh7uVydtf3OJ7sGwAW_mr2wuILeAzLNL4OMk34rzx_8M72sjDrQViNiC28JrvhNvzx3p1qN4cn740T1GwHEIyn-6fW0fHtvbb22wUd8XC-yHeAbLmb2Y► Log after running
adb: logcat | findstr LeanplumCloudMessagingProvider► ❔ Force closed Firefox Beta 82.0.0-beta.3 and re-run
adb: logcat | findstr LeanplumCloudMessagingProviderand resulted in the following log:10-05 12:58:35.255 24776 24776 I [INFO][Leanplum]: [com.leanplum.LeanplumCloudMessagingProvider::onRegistrationIdReceived::3]: Device registered for push notifications with registration token, dfE4oI5e7hk:APA91bFbigGVQdFL5RhtrhQoCGWAc-5YVsmgagQROcypF-w6qF-i-Btva2rAco4kF-iro8r01-7_Maiq_3DPIjjVmS86OZr1mgFIE9BflmC2sIU5QM_DgolPGLFPYfTAdfaLPLUw6RE5► Re-checked on Leanplum

✔️ Device ID: ccddf528-eb11-455a-9c34-0ad76424601e
❔ Android push token:
dfE4oI5e7hk:APA91bFbigGVQdFL5RhtrhQoCGWAc-5YVsmgagQROcypF-w6qF-i-Btva2rAco4kF-iro8r01-7_Maiq_3DPIjjVmS86OZr1mgFIE9BflmC2sIU5QM_DgolPGLFPYfTAdfaLPLUw6RE5• Sent a Push Notification VIA Leanplum
✔️ Properly sent the Push Notification VIA Leanplum based on the User ID
✔️ Received the notification and after tapping it Firefox Beta opened
► Video

📝Notes:
✔️ The device ID was inherited from Fennec Beta
✔️ Properly sent and received the push notification.
✔️ Tapping it opened
https://www.mozilla.org❓ The push token got changed as it follows:
Fennec :
APA91bGT8kB2ahLCZ55ziqs-GV8R7frPnm_3EqM-HQeCjW9qbTOoKgJiXKPmHOFwjBRWsjszHbntQyLAGeXhRsSBjuXtnZTuT-5KyIEK1B2HO29UL6M0JXdXWZ7GneinKP-EL_1etprHJ1QOGVu3wMIYLeQSGUhrtg▼
Right after the update the log showed 2 new push tokens:
✔️Same as per Leanplum
cQfGwa2M3oc:APA91bGJa5RkCVP45xDDOhA3nh7uVydtf3OJ7sGwAW_mr2wuILeAzLNL4OMk34rzx_8M72sjDrQViNiC28JrvhNvzx3p1qN4cn740T1GwHEIyn-6fW0fHtvbb22wUd8XC-yHeAbLmb2Yand
❔ Different than the one displayed in Leanplum
dfE4oI5e7hk:APA91bFbigGVQdFL5RhtrhQoCGWAc-5YVsmgagQROcypF-w6qF-i-Btva2rAco4kF-iro8r01-7_Maiq_3DPIjjVmS86OZr1mgFIE9BflmC2sIU5QM_DgolPGLFPYfTAdfaLPLUw6RE5▼
Force closed Firefox Beta 82.0.0-beta.3 and rechecked both the log and Leanplum and it got changed to:
✔️
dfE4oI5e7hk:APA91bFbigGVQdFL5RhtrhQoCGWAc-5YVsmgagQROcypF-w6qF-i-Btva2rAco4kF-iro8r01-7_Maiq_3DPIjjVmS86OZr1mgFIE9BflmC2sIU5QM_DgolPGLFPYfTAdfaLPLUw6RE5@st3fan could you please review and advise? ☺️
Not sure if the push token changes after performing a migration are expected or not?