0

I want my android application to take automatically owner name from deice. So, how I get the owner information (like owner name) from android device.

Shaishav
  • 5,282
  • 2
  • 22
  • 41
Prathap Badavath
  • 1,621
  • 2
  • 20
  • 24

2 Answers2

0

This code will help you get the owner name stored in the device

Cursor c = getApplication().getContentResolver().query(ContactsContract.Profile.CONTENT_URI, null, null, null, null); 
c.moveToFirst();
textView.setText(c.getString(c.getColumnIndex("display_name")));
c.close();

make sure to add this permission to your manifest:

<uses-permission android:name="android.permission.READ_PROFILE"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
karimkhan
  • 321
  • 3
  • 18
  • then use this [link](http://stackoverflow.com/questions/6222384/possible-to-get-owner-contact-info-in-android) – karimkhan Aug 08 '16 at 11:24
0

Please refer this link for accessing the device related information

https://developer.android.com/reference/android/os/Build.html

if you want to get the playstore user account information you have to use the firebase play service api to get the account information

Please refer this link for more reference https://firebase.google.com/docs/auth/android/manage-users