What App Center service does this affect?
Push with setUserId
Describe the bug
I am calling setUserId but it is not always sent to AppCenter servers.
[MSAppCenter setUserId:userId];
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Every time I call setUserId the userId is reported to AppCenter servers and visible in the JSON payload.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Here you can see the first JSON payload with no userId
{
"logs": [{
"device": {
"screenSize": "1136x640",
"appBuild": "24",
"osName": "iOS",
"timeZoneOffset": -360,
"carrierCountry": "us",
"osVersion": "12.3.1",
"carrierName": "Verizon",
"locale": "en_US",
"appNamespace": "test",
"osBuild": "16F203",
"sdkName": "appcenter.ios",
"oemName": "Apple",
"model": "iPhone10,3",
"sdkVersion": "1.14.0",
"appVersion": "1.0.18"
},
"timestamp": "2019-05-31T23:43:36.670Z",
"type": "startService",
"services": ["Push"]
}]
}
Here you can see the second JSON payload that does contain the userId
{
"logs": [{
"timestamp": "2019-05-31T23:43:36.799Z",
"device": {
"screenSize": "1136x640",
"appBuild": "24",
"osName": "iOS",
"timeZoneOffset": -360,
"carrierCountry": "us",
"osVersion": "12.3.1",
"carrierName": "Verizon",
"locale": "en_US",
"appNamespace": "com.test",
"osBuild": "16F203",
"sdkName": "appcenter.ios",
"oemName": "Apple",
"model": "iPhone10,3",
"sdkVersion": "1.14.0",
"appVersion": "1.0.18"
},
"type": "pushInstallation",
"userId": "273389",
"pushToken": "<REMOVED>"
}]
}
I see this issue on Android (using Xamarin Forms). Setting the user id worked maybe 2 out of 10 cases for me. If I send a push to all registered devices on the portal, I successfully receive it on the client device, but push by user does not work because the id has not been registered. This is why, I believe I'm seeing 0/0 results as shown on #506 because the notifications were never sent.
@skabber even though this relates to push, it's likely an issue with the SDK, so I've assigned this to the SDK team to take a look. If it turns out this is Push related, I'll look deeper into it after the SDK team has had its say.
Hi, a bug was in version 2.0.0 to re-send push log on userId update.
From the logs we can see you use version 1.14.0, so updating the nugets should fix this issue.
This can be closed. The update to the latest version has fixed it.
Thanks
app center push package - version 2.1.1
when I use setUserId() to to update the registered userId when a user is switching login user, the push is sent to the pervious userId still.
on iOS 12.3.1 iPhone5
I think this issue has not been properly fixed.
@ewoody how much time between login and push send? There's a window where things can not align properly. The ID refresh is not instantaneous, so what you're experiencing can happen. We documented this here: https://devblogs.microsoft.com/appcenter/visual-studio-app-center-user-identity-shared-devices/.