Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get language-specific name using API

Is there a way to retrieve language-specific name for a user, using Graph API?

like image 218
paul_e Avatar asked Nov 22 '25 12:11

paul_e


1 Answers

I am finding answer of this question. And finally, I got a solution for this.

step 1. First, request below api

/v2.4/me?fields=id,name,locale

then, you received locale information of the user.

step 2. Now, request below api

/v2.4/me?fields=id,name?locale="locale received in step 1"

If you use android facebook sdk like me, then write code like below.

Bundle bundle = new Bundle();
bundle.putString("fields", "id,name,locale");
//bundle.putString("locale", "ko_KR");
new GraphRequest(
        AccessToken.getCurrentAccessToken(),
        "/me",
        bundle,
        HttpMethod.GET,
        new GraphRequest.Callback() {
            public void onCompleted(GraphResponse response) {
                Log.d(TAG, "response -> " + response.getRawResponse());
            }
        }
).executeAsync();

"me" can be converted into "". I tested in the graph api(v2.4). Thank you!

like image 99
JoonYoung Yi Avatar answered Nov 24 '25 01:11

JoonYoung Yi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!