title: Best possible way to get device Id in Android
body: <p>I just wonder what would be the best to get device id I have 2 options either I use below code that would need run time permission <code>android.permission.READ_PHONE_STATE</code> - </p>
  
  <pre><code>private String android_id = Secure.getString(getContext().getContentResolver(),
                                                          Secure.ANDROID_ID); 
  </code></pre>
  
  <p>Or</p>
  
  <p>Secondly I have option of UUID that will not need any run time permission but need to be mapped with users data(like email or phone) to identify.</p>
  
  <pre><code>String uniqueID = UUID.randomUUID().toString();
  </code></pre>
  
  <p>Any suggestions which one to use and why would be appreciated.</p>
  
  <p>Thanks</p>