title: Android: get user ID without requiring scary (for user) permissions?
body: <p>In order to manage user preferences, at present I'm grabbing the google user name (effectively the email address they've registered to the device) and using (a hash of) that as a "user ID" to distinguish between different users.  Something along the lines of what is described <a href="https://stackoverflow.com/a/4039018/4070848">here</a>.</p>
  
  <p>That all works fine, but some users are (understandably) scared off by any permission that seems to give the app some evil power to trawl through their account info or contacts.</p>
  
  <p>EDIT: this issue is even more acute with the way in which Google has now implemented <a href="http://developer.android.com/guide/topics/security/permissions.html#perm-groups" rel="noreferrer">Permission Groups</a> in the Android 6 <a href="http://developer.android.com/training/permissions/requesting.html" rel="noreferrer">runtime permission</a> schema.  They have put <code>GET_ACCOUNTS</code> into the <code>CONTACTS</code> permission group.  So now, in order to generate a unique anonymous User ID, the user has to be presented with a dialog that says:</p>
  
  <blockquote>
    <p>Allow this app to access your contacts?   | Deny | Allow |</p>
  </blockquote>
  
  <p>How misleading is that??  My app has no wish to access contacts, but the user is being asked to grant permission for the app to access contacts!  Yes, there is an opportunity to explain to the user with a separate dialog that, in fact, access to contacts is NOT required, but then they still get the stock system dialog that asks them to grant permission to access contacts... naturally they will think "why am I being asked to grant this permission if access to contacts is not required?" and "do I really trust the developer?  they say access to contacts is not required, but is that really true?"... very very confusing and a very poor user experience IMHO (and the opinion of <a href="https://code.google.com/p/android/issues/detail?id=189766" rel="noreferrer">others too</a>).</p>
  
  <p>I'd rather just avoid all of this hassle and confusion and obtain a unique user ID without special permissions being required.</p>
  
  <p>So is there a stock function or method in the SDK that will return a unique user ID for the user, without requiring any additional permission?  I'm kinda surprised if there isn't, because it would seem to be quite a common thing to want to do... to have a user ID for managing app users.</p>
  
  <p>Two points:</p>
  
  <p>(a) I only need an anonymous user ID... I don't actually need the user's email address, nor would I ever want the user's email address.  So I can't see why google can't provide a <code>getUserID()</code> method that returns a unique anonymised ID, without having to grant special permissions to the app.</p>
  
  <p>(b) It has to be a user ID, not a device ID, so that it will work across all of the user's devices registered to the same google account.</p>
  
  <p>Thanks.</p>