chat21 / chat21-android-sdk

Android Chat SDK built on Firebase
http://www.chat21.org
MIT License
233 stars 98 forks source link

Why I can't change user image #17

Closed BendiRKO closed 5 years ago

BendiRKO commented 6 years ago

I am trying to change user profile image and it's not working in app demo on playstore and it's not working on project app demo

karthiciist commented 5 years ago

In the demo project, user data will be stored in contacts node in firebase database. Like this : image

Here, you can see that there is no value stored in imageurl. so you will not get any image in profile section.

In your custom project, you can change it and pass firebaseauth.getcurrentuser().getprofilepicurl() to fetch the user profile pic url.

BendiRKO commented 5 years ago

Hi, thanks for reply, can you tell me how to do it

karthiciist commented 5 years ago

You can use any image picker library like this or this to get the image from your user's phone and upload the bitmap to firebase storage or any other online storage and get the URL of that image.

Now pass this URL to "imageurl" variable of "contacts" node in my previous answer. Now you will get the profile pic in your app.

If you want to check it before deploying, manually insert any picture URL in "imageurl" shown in the above image and run your app. You will see the profile pic in your app.

If you are using google signin in your app, just calling firebaseAuth().getCurrentUser().getProfilePic() will return the profile pic url of the current user.

Good luck :)