1

I would like to get the user's name in my app so that it can provide a personalized message during it's first run like,

Hey %user's name,

..

Since the app will be paid and primarily available on Google Play Store, i would have all the information about the user as in their synced gmail account. But how do i go about writing code for it?

Community
  • 1
  • 1
Nissim R
  • 542
  • 11
  • 29
  • 1
    You compile the Google Sign-In API, probably – OneCricketeer Jan 10 '17 at 16:03
  • Or, if you just want to read the primary contact, you could try this http://stackoverflow.com/questions/2112965/how-to-get-the-android-devices-primary-e-mail-address#2175688 – OneCricketeer Jan 10 '17 at 16:04
  • 2
    The device may not know the user's name. Not all devices ask for a name as part of the setup wizard, and I have yet to encounter one that forces the user to provide a name. Also, not all users will associate any sort of account (e.g., Google account) with their device. – CommonsWare Jan 10 '17 at 16:04
  • @cricket_007 isn't Google Sign-In API for websites? and i need their name.. – Nissim R Jan 10 '17 at 16:07
  • @CommonsWare not the device itself, no, but google does when you create an account. And since the app will be a paid one available primarily on Google Play Store, they need a gmail account to pay for it. – Nissim R Jan 10 '17 at 16:09
  • Nope, works on Android. https://developer.android.com/training/sign-in/index.html – OneCricketeer Jan 10 '17 at 16:09

1 Answers1

0

As suggested by cricket_007, Google Sign-In API provides the user's display name.

enter image description here

Nissim R
  • 542
  • 11
  • 29