Is it possible to change automatically selected user property in Firebase

Vishal Vijay :

Firebase SDK automatically collects some of the important and common user properties. Which can be found here.

In our app and website, we auto-detect the user's country. We also allow the user to change it to their preferred country if needed. We are using this country value for providing more localized content.

The current problem which we are facing now is, the auto-detected country is mostly the same as Firebase automatically select country (user property). But if the user manually changes the country to a different one in the app, the country in Firebase and app won't match. Which is leading to lot of inconsistencies. For example, assume the user changed the country from IN to the US in the app. And from the Firebase dashboard, we send push notification targeting Indian users, the push notification will also be received by the above user, which is not correct.

To solve this problem we came up with 2 solutions,

  1. Create a new custom user property called app_selected_country. This is a great solution, but we can't use this property immediately because of old & existing users won't be having this value without they update and use the app.
  2. If we can change the automatically logged user property programmatically from the app and website, we could update the country user property to the app's country.

Our preferred option is the 2nd one. Because we'll be able to use the country user property the same as before. Even if the users won't update the app, we'll be able to use this property with existing data errors, which is fine for us.

The challenge with this approach is that we can't find any documentation regarding updating automatically logged user property.

So can you please help me answer these questions,

  1. Is it possible to update automatically logged user property in Firebase? If so what is the user property key for the country?
  2. Is there any side effect of doing this? We are a bit worried because we are changing the value detected by Firebase.
Dan Morenus :

Unfortunately there is no way to change the auto-detected country. You will need to use your first proposed solution.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=11364&siteId=1