简体   繁体   中英

Android Firebase — Storing Google Profile Picture

I am creating an account setup page for my app. So I am giving an ImageView for setting profile pictures.

I am loading the image in the following way:

Glide.with(AccountSetupActivity.this)
                        .load(mAuth.getCurrentUser().getPhotoUrl())
                        .into(mCircularProfile); //mCircularProfile is ImageView

It works flawlessly. The problem is when i try to store this file.

mImageUri = mAuth.getCurrentUser().getPhotoUrl();

StorageReference filePath
                    = mStorageProfilePicturesRef.child("just a random name for testing");
            //Putting The Image At The Specific File Path
            filePath.putFile(mImageUri)

Any help is greatly appreciated!

There is a difference between URL and Uri. The error is because you are trying to store the String URL into uri .Convert the Url into Uri.

mImageUri =  Uri.parse(mAuth.getCurrentUser().getPhotoUrl());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM