Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8843277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:10:49+00:00 2026-06-14T11:10:49+00:00

I’m using Facebook SDK in my Android App. And I need to get all

  • 0

I’m using Facebook SDK in my Android App. And I need to get all the information of the user. By now I’m able to get the Name ID Email Birthday and the profile pic of the user. The last one that I need to get is the location or current location of the user. I’m using this code below.

if(fb.isSessionValid()){
            button.setImageResource(R.drawable.logout_button);

            JSONObject obj = null;
            URL img = null;


             try {
                    String jsonUser = fb.request("me");
                    obj = Util.parseJson(jsonUser);
                    String id = obj.optString("id");
                    String name = obj.optString("name");
                    String bday = obj.optString("birthday");
                    String address = obj.optString("location");
                    String email = obj.optString("email");
                    ((TextView) findViewById(R.id.txt)).setText("Welcome! "+name);
                    ((TextView) findViewById(R.id.txtbday)).setText("Birthday: "+bday);
                    ((TextView) findViewById(R.id.txtaddress)).setText("Address: "+address);
                    ((TextView) findViewById(R.id.txtemail)).setText("Email: "+email);
                    img = new URL("http://graph.facebook.com/"+id+"/picture?type=normal");
                    Bitmap bmp = BitmapFactory.decodeStream(img.openConnection().getInputStream());
                    pic.setImageBitmap(bmp);

                } catch (FacebookError e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (JSONException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (MalformedURLException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }



        }else{
            button.setImageResource(R.drawable.login_button);
        }
    }

Here are the permissions

fb.authorize(MainActivity.this,new String[] {"email", "user_location", "user_birthday","publish_stream"}, new DialogListener() {

                public void onFacebookError(FacebookError e) {
                    // TODO Auto-generated method stub
                    Toast.makeText(getApplicationContext(), ""+e, Toast.LENGTH_SHORT).show();   
                    e.printStackTrace();
                }

                public void onError(DialogError e) {
                    // TODO Auto-generated method stub
                    //Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_SHORT).show();      
                }

                public void onComplete(Bundle values) {
                    // TODO Auto-generated method stub
                    Editor editor = sp.edit();
                    editor.putString("access_token", fb.getAccessToken());
                    editor.putLong("access_expires", fb.getAccessExpires());
                    editor.commit();
                    updateButtonImage();
                }

                public void onCancel() {
                    // TODO Auto-generated method stub
                    Toast.makeText(getApplicationContext(), "Cancel", Toast.LENGTH_SHORT).show();   
                }
            });
        }

Thanks for who will help in advanced.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:10:50+00:00Added an answer on June 14, 2026 at 11:10 am

    The Graph API Explorer tool is a great way to see what the response of a graph API endpoint is. Just request the right permissions (such as user_location) by clicking “Get Access Token” and see the output of ‘/me’. When I get an access token with the user_location permission I am able to see my current

    https://developers.facebook.com/tools/explorer/?method=GET&path=me

    To get the current location, this is how to do it:

    String currentCity = obj.getJSONObject("location").getString("name");
    

    With newer SDKs you can get location detail by passing as below with graph API object

    graphObject.getInnerJSONObject().getJSONObject("location").getString("id"))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
We're building an app, our first using Rails 3, and we're having to build
I have thousands of HTML files to process using Groovy/Java and I need to
I am using Paperclip to handle profile photo uploads in my app. They upload
I need to clean up various Word 'smart' characters in user input, including but
Let's say I'm outputting a post title and in our database, it's Hello Y’all
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.