Note that there are some explanatory texts on larger screens.

plurals
  1. POlocation values are null with facebook API in android
    primarykey
    data
    text
    <p>I'm trying to make a simple app where the only thing i want to retrieve are the coordinates of my current position, using facebook user's data. I'm following this guide to get started with this: <a href="https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/" rel="nofollow">https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/</a></p> <p>The only difference is where I substituted </p> <pre><code>user.getName(); </code></pre> <p>with</p> <pre><code>user.getLocation().getLatitude(); //it's always null and so throws exception. </code></pre> <p>then i tried other methods like getCountry() or getState(); the value is always null.</p> <p>Anybody knows how to fix this and get the location values using these methods? Thanks.</p> <p>Here is my portion of code:</p> <pre><code> @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // start Facebook Login Session.openActiveSession(this, true, new Session.StatusCallback() { // callback when session changes state @Override public void call(Session session, SessionState state, Exception exception) { if (session.isOpened()) { // make request to the /me API Request.executeMeRequestAsync(session, new Request.GraphUserCallback() { // callback after Graph API response with user object @Override public void onCompleted(GraphUser user, Response response) { if (user != null) { TextView txt = (TextView) findViewById(R.id.text); txt.setText("Latitude is: " + user.getLocation().getLatitude()); } } }); } } }); } </code></pre> <p>edit: in the hackbook project sample which comes with the facebook sdk, I see that's possible to get coordinates (latitude and longitude) by the location ID, anyone knows how?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload