title: Generating a unique ID for an application instance
body: <p>I'm looking to generate a unique identifier (String) for the application instance.</p>
  
  <p>I need this because I'm storing user profiles in <a href="https://firebase.google.com/docs/firestore/manage-data/add-data" rel="nofollow noreferrer">Firestore</a> in this format:</p>
  
  <pre><code>/phones/{phoneId}/users/{user}/
  </code></pre>
  
  <p>..where there are multiple user profiles on 1 device (no authentication). <code>phoneId</code> is meant to be the unique string identifier for the application instance. </p>
  
  <p>However, when I perform:</p>
  
  <pre><code>var uniqueID = UUID.randomUUID().toString()
  Log.d("UniqueID", uniqueID )
  </code></pre>
  
  <p><code>uniqueId</code> returns a random string every time. <a href="https://developer.android.com/training/articles/user-data-ids#working_with_instance_ids_&amp;_guids" rel="nofollow noreferrer">The documentation states that "GUIDs can also be used to uniquely identify an app instance"</a>- but like I said I'm not getting the same string every time <code>uniqueId</code> prints. </p>
  
  <p>Any reason why this is or if there's a better alternative to have an immutable string to uniquely identify the app instance? </p>