1

Possible Duplicate:
How to find Gmail account associated with Android Market?

In Android, is there an easy way in code to detect if the user has linked their phone to Google Market using a gmail address?

Community
  • 1
  • 1
Michael
  • 3,699
  • 4
  • 26
  • 27

1 Answers1

2

It seems to me like the right thing to ask at this point is, "What are you really trying to do?"

The most obvious use case I can think of is to verify that the user is legitimately using your app, in which case you might find the right answer in Application Licensing: http://developer.android.com/guide/google/play/licensing/index.html

The next most obvious use case I can think of is you want to help the user install something, in which case maybe your answer is in Linking to your Application: http://developer.android.com/distribute/googleplay/promote/linking.html

For other cases, the answer may begin with Account Manager. Try here: http://developer.android.com/training/id-auth/identify.html

Sparky
  • 8,437
  • 1
  • 29
  • 41
  • Wow thanks. I did not know that there was something like that ! – Ahmad Jul 22 '12 at 03:22
  • Thanks Sparky. What I am trying to achieve here is to warn user that their push notification (c2dm) won't work if the phone is not linked to any Google market account. – Michael Aug 07 '12 at 17:55
  • 1
    Hi Michael, got it. In that case, I think the AccountManager route is what you want. Alternatively, since the app requires a (Market) Play account anyway, you could distribute it only through that channel. ;-) You could also put your disclaimer in the copy in your download listing. Or try to register as a C2DM receiver and see if it fails. And if you can't get C2DM (GCM) on a device, well, there's always polling as a fallback position. – Sparky Aug 07 '12 at 18:02