How to get the phone user's name?












0















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.





  • AccountManager returns only the email address, which I don't need.


  • ContactsContract.Contacts contains only other people data.


  • ContactsContract.Profile seems to be empty.


  • ContactsContract.Data doesn'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.










share|improve this question























  • 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_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













  • @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
















0















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.





  • AccountManager returns only the email address, which I don't need.


  • ContactsContract.Contacts contains only other people data.


  • ContactsContract.Profile seems to be empty.


  • ContactsContract.Data doesn'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.










share|improve this question























  • 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_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













  • @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














0












0








0








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.





  • AccountManager returns only the email address, which I don't need.


  • ContactsContract.Contacts contains only other people data.


  • ContactsContract.Profile seems to be empty.


  • ContactsContract.Data doesn'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.










share|improve this question














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.





  • AccountManager returns only the email address, which I don't need.


  • ContactsContract.Contacts contains only other people data.


  • ContactsContract.Profile seems to be empty.


  • ContactsContract.Data doesn'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.







android username






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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 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













  • @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











  • 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











  • 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












2 Answers
2






active

oldest

votes


















0














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






share|improve this answer































    0














    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






    share|improve this answer
























    • 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











    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    0














    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






    share|improve this answer




























      0














      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






      share|improve this answer


























        0












        0








        0







        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






        share|improve this answer













        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







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 11 '17 at 20:19









        Shriyansh GautamShriyansh Gautam

        9611213




        9611213

























            0














            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






            share|improve this answer
























            • 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
















            0














            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






            share|improve this answer
























            • 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














            0












            0








            0







            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






            share|improve this answer













            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







            share|improve this answer












            share|improve this answer



            share|improve this answer










            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



















            • 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


















            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            List item for chat from Array inside array React Native

            Thiostrepton

            Caerphilly