Android- How to upload image to Firebase under specific users -


i developing app, , far it's able upload images, , register users. however, these 2 functionalities run independent of each other. ergo, need make images saved under user uploads it. novice android programmer , started learning firebase , use help.

in registration process,

            firebaseauth.getinstance()             .createuserwithemailandpassword(email, email)             .addoncompletelistener(new oncompletelistener<authresult>() {                 @override                 public void oncomplete(@nonnull task<authresult> task) {                     android.util.log.e("firebase", "performfirebaseregistration:oncomplete:" + task.issuccessful());                     // if sign in fails, display message user. if sign in succeeds                     // auth state listener notified , logic handle                     // signed in user can handled in listener.                     if (!task.issuccessful()) {                         alertutils.showalert(mainactivity.this, getstring(r.string.sign_up), task.getexception().getmessage());                     } else {                       firebaseuser firebaseuser = task.getresult().getuser(); // here userdetails                      }                 }             }); 

from firebaseuser can user id firebaseuser.getuid().

once upload message,sent realtime firebase b user id below,

  databasereference database =    firebasedatabase.getinstance().getreference();     database.child(arg_users)               .child(firebaseuser.getuid())             .child("image")             .setvalue(<you image download url>); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -