title: How do I synchronize Firebase Storage and Database?
body: <p>I have yet to find any good documentation to tell me how to manage this issue. Is there any guidance someone can reference for this issue?</p>
  
  <p>For an Android app, I have started using Google Firebase Storage along with my realtime Database, and I have a question on how to ensure file uploads and database updates happen in the proper order.</p>
  
  <p>Previously, I was encoding an audio file to a string and uploading it to FB Database along with other related data as a single hash map to ensure consistency. The related data that is being stored is a POJO relating to what users can access the audio, the path where the audio is stored in the database, and more.</p>
  
  <p>My new set up is first to upload the audio file to FB Storage, and, once the file is uploaded, trigger a FB Database update for the related data. Once the database listener indicates completion, the app moves to a different activity.</p>
  
  <p>I am concerned that this two step process is unstable (user leaves the activity before both tasks are done, Storage upload is interrupted and Database update never occurs, etc.). If the Database information isn't updated, the other users won't be notified that the audio file is online and they won't have the path to reference it stored in the database.</p>
  
  <p>What is the proper order for structuring simultaneous Storage and Database uploads in the new Google Firebase?</p>
  
  <p>Thanks,
  Andy</p>