How to get the phone user's name?
My application needs the user's display name. In System Settings, under the Users section, I can see my name. That would be fine for my app. How can I get that or a similar string?
Sevenal suggestions to how to do this I found on StackOverflow did not work for me.
AccountManagerreturns only the email address, which I don't need.
ContactsContract.Contactscontains only other people data.
ContactsContract.Profileseems to be empty.
ContactsContract.Datadoesn't containt that name I need.- I wouldn't use oAuth or such login services. My app doesn't need account management, it just needs a name of the phone owner.
|
show 3 more comments
My application needs the user's display name. In System Settings, under the Users section, I can see my name. That would be fine for my app. How can I get that or a similar string?
Sevenal suggestions to how to do this I found on StackOverflow did not work for me.
AccountManagerreturns only the email address, which I don't need.
ContactsContract.Contactscontains only other people data.
ContactsContract.Profileseems to be empty.
ContactsContract.Datadoesn't containt that name I need.- I wouldn't use oAuth or such login services. My app doesn't need account management, it just needs a name of the phone owner.
For Security reasons you cannot get phone user's name without accounts permission
– Shriyansh Gautam
Sep 11 '17 at 18:58
stackoverflow.com/questions/20360506/…
– Gowthaman M
Sep 11 '17 at 19:05
@ShriyanshGautam The app requestsGET_ACCOUNTS,READ_CONTACTSpremissions, and both these +READ_PROFILEare listed in the manifest.
– klenium
Sep 11 '17 at 19:06
Still for gettting User's Name you need to implement Google Sign-in developers.google.com/identity/sign-in/android/people
– Shriyansh Gautam
Sep 11 '17 at 19:12
@ShriyanshGautam Are you sure, there is no other option to get a short name? Getting the user's email is easy, but more dangerous...
– klenium
Sep 11 '17 at 19:21
|
show 3 more comments
My application needs the user's display name. In System Settings, under the Users section, I can see my name. That would be fine for my app. How can I get that or a similar string?
Sevenal suggestions to how to do this I found on StackOverflow did not work for me.
AccountManagerreturns only the email address, which I don't need.
ContactsContract.Contactscontains only other people data.
ContactsContract.Profileseems to be empty.
ContactsContract.Datadoesn't containt that name I need.- I wouldn't use oAuth or such login services. My app doesn't need account management, it just needs a name of the phone owner.
My application needs the user's display name. In System Settings, under the Users section, I can see my name. That would be fine for my app. How can I get that or a similar string?
Sevenal suggestions to how to do this I found on StackOverflow did not work for me.
AccountManagerreturns only the email address, which I don't need.
ContactsContract.Contactscontains only other people data.
ContactsContract.Profileseems to be empty.
ContactsContract.Datadoesn't containt that name I need.- I wouldn't use oAuth or such login services. My app doesn't need account management, it just needs a name of the phone owner.
asked Sep 11 '17 at 18:54
kleniumklenium
1,3501032
1,3501032
For Security reasons you cannot get phone user's name without accounts permission
– Shriyansh Gautam
Sep 11 '17 at 18:58
stackoverflow.com/questions/20360506/…
– Gowthaman M
Sep 11 '17 at 19:05
@ShriyanshGautam The app requestsGET_ACCOUNTS,READ_CONTACTSpremissions, and both these +READ_PROFILEare listed in the manifest.
– klenium
Sep 11 '17 at 19:06
Still for gettting User's Name you need to implement Google Sign-in developers.google.com/identity/sign-in/android/people
– Shriyansh Gautam
Sep 11 '17 at 19:12
@ShriyanshGautam Are you sure, there is no other option to get a short name? Getting the user's email is easy, but more dangerous...
– klenium
Sep 11 '17 at 19:21
|
show 3 more comments
For Security reasons you cannot get phone user's name without accounts permission
– Shriyansh Gautam
Sep 11 '17 at 18:58
stackoverflow.com/questions/20360506/…
– Gowthaman M
Sep 11 '17 at 19:05
@ShriyanshGautam The app requestsGET_ACCOUNTS,READ_CONTACTSpremissions, and both these +READ_PROFILEare listed in the manifest.
– klenium
Sep 11 '17 at 19:06
Still for gettting User's Name you need to implement Google Sign-in developers.google.com/identity/sign-in/android/people
– Shriyansh Gautam
Sep 11 '17 at 19:12
@ShriyanshGautam Are you sure, there is no other option to get a short name? Getting the user's email is easy, but more dangerous...
– klenium
Sep 11 '17 at 19:21
For Security reasons you cannot get phone user's name without accounts permission
– Shriyansh Gautam
Sep 11 '17 at 18:58
For Security reasons you cannot get phone user's name without accounts permission
– Shriyansh Gautam
Sep 11 '17 at 18:58
stackoverflow.com/questions/20360506/…
– Gowthaman M
Sep 11 '17 at 19:05
stackoverflow.com/questions/20360506/…
– Gowthaman M
Sep 11 '17 at 19:05
@ShriyanshGautam The app requests
GET_ACCOUNTS, READ_CONTACTS premissions, and both these + READ_PROFILE are listed in the manifest.– klenium
Sep 11 '17 at 19:06
@ShriyanshGautam The app requests
GET_ACCOUNTS, READ_CONTACTS premissions, and both these + READ_PROFILE are listed in the manifest.– klenium
Sep 11 '17 at 19:06
Still for gettting User's Name you need to implement Google Sign-in developers.google.com/identity/sign-in/android/people
– Shriyansh Gautam
Sep 11 '17 at 19:12
Still for gettting User's Name you need to implement Google Sign-in developers.google.com/identity/sign-in/android/people
– Shriyansh Gautam
Sep 11 '17 at 19:12
@ShriyanshGautam Are you sure, there is no other option to get a short name? Getting the user's email is easy, but more dangerous...
– klenium
Sep 11 '17 at 19:21
@ShriyanshGautam Are you sure, there is no other option to get a short name? Getting the user's email is easy, but more dangerous...
– klenium
Sep 11 '17 at 19:21
|
show 3 more comments
2 Answers
2
active
oldest
votes
You can get users email with GET_ACCOUTNS permission but for getting User Name you need to implement some OAuth to access User's Name and other profile informations.
One way is to user Google Sign-in developers.google.com/identity/sign-in/android/people
add a comment |
use String getUserName () method
Returns the user name of the user making this call. This call is only available to applications on the system image; it requires the MANAGE_USERS permission.
for referenceClick here
I can't grant that premission in an easy way. If I really need, I'll use Google Sign-in then.
– klenium
Sep 11 '17 at 20:25
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46162597%2fhow-to-get-the-phone-users-name%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can get users email with GET_ACCOUTNS permission but for getting User Name you need to implement some OAuth to access User's Name and other profile informations.
One way is to user Google Sign-in developers.google.com/identity/sign-in/android/people
add a comment |
You can get users email with GET_ACCOUTNS permission but for getting User Name you need to implement some OAuth to access User's Name and other profile informations.
One way is to user Google Sign-in developers.google.com/identity/sign-in/android/people
add a comment |
You can get users email with GET_ACCOUTNS permission but for getting User Name you need to implement some OAuth to access User's Name and other profile informations.
One way is to user Google Sign-in developers.google.com/identity/sign-in/android/people
You can get users email with GET_ACCOUTNS permission but for getting User Name you need to implement some OAuth to access User's Name and other profile informations.
One way is to user Google Sign-in developers.google.com/identity/sign-in/android/people
answered Sep 11 '17 at 20:19
Shriyansh GautamShriyansh Gautam
9611213
9611213
add a comment |
add a comment |
use String getUserName () method
Returns the user name of the user making this call. This call is only available to applications on the system image; it requires the MANAGE_USERS permission.
for referenceClick here
I can't grant that premission in an easy way. If I really need, I'll use Google Sign-in then.
– klenium
Sep 11 '17 at 20:25
add a comment |
use String getUserName () method
Returns the user name of the user making this call. This call is only available to applications on the system image; it requires the MANAGE_USERS permission.
for referenceClick here
I can't grant that premission in an easy way. If I really need, I'll use Google Sign-in then.
– klenium
Sep 11 '17 at 20:25
add a comment |
use String getUserName () method
Returns the user name of the user making this call. This call is only available to applications on the system image; it requires the MANAGE_USERS permission.
for referenceClick here
use String getUserName () method
Returns the user name of the user making this call. This call is only available to applications on the system image; it requires the MANAGE_USERS permission.
for referenceClick here
answered Sep 11 '17 at 20:05
AnshulAnshul
694
694
I can't grant that premission in an easy way. If I really need, I'll use Google Sign-in then.
– klenium
Sep 11 '17 at 20:25
add a comment |
I can't grant that premission in an easy way. If I really need, I'll use Google Sign-in then.
– klenium
Sep 11 '17 at 20:25
I can't grant that premission in an easy way. If I really need, I'll use Google Sign-in then.
– klenium
Sep 11 '17 at 20:25
I can't grant that premission in an easy way. If I really need, I'll use Google Sign-in then.
– klenium
Sep 11 '17 at 20:25
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46162597%2fhow-to-get-the-phone-users-name%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
For Security reasons you cannot get phone user's name without accounts permission
– Shriyansh Gautam
Sep 11 '17 at 18:58
stackoverflow.com/questions/20360506/…
– Gowthaman M
Sep 11 '17 at 19:05
@ShriyanshGautam The app requests
GET_ACCOUNTS,READ_CONTACTSpremissions, and both these +READ_PROFILEare listed in the manifest.– klenium
Sep 11 '17 at 19:06
Still for gettting User's Name you need to implement Google Sign-in developers.google.com/identity/sign-in/android/people
– Shriyansh Gautam
Sep 11 '17 at 19:12
@ShriyanshGautam Are you sure, there is no other option to get a short name? Getting the user's email is easy, but more dangerous...
– klenium
Sep 11 '17 at 19:21