facebook-android-sdk

How to get current access token in Facebook Android SDK V4?

偶尔善良 提交于 2019-12-12 08:53:51
问题 I want to check whether the user is logged in or not within the main FragmentActivity but although the user is logged in AccessToken.getCurrentAccessToken() returns null. What am I doing wrong in the code below ? public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); context = this; FacebookSdk.sdkInitialize(context); callbackManager = CallbackManager.Factory.create(); AccessToken accessToken = AccessToken.getCurrentAccessToken(); if (accessToken != null) { if (

Release apk Facebook hash key not same with generated one

谁都会走 提交于 2019-12-12 08:41:36
问题 I am developing an Android app. In my app, I am integrating Facebook Login. My facebook login working fine. But not working when I produce release apk and run that app and try to log in with Facebook. Please see my scenario below. I generate release apk like below Then I generate keyhash using that jks file path. I got a hash key and then add it to the developer profile settings. When I install and run that apk on my device and login using Facebook, it always shows error like below. Facebook

Facebook friend invitation request doesn't display the message

一个人想着一个人 提交于 2019-12-12 05:05:31
问题 I have a String message = "hi"; and when the user gets the invitation he doesn't see my message, but something like you have a request from ... params.putString("message", message); params.putString("to", "123123123"); WebDialog webdialog = new WebDialog.Builder(PurchaseFlowActivity.this, Session.getActiveSession(), action, params) .setOnCompleteListener(new WebDialog.OnCompleteListener() { @Override public void onComplete(Bundle values, FacebookException error) { } }).build(); Window dialog

Facebook SDK - Wrong ID while invating friends

与世无争的帅哥 提交于 2019-12-12 04:56:43
问题 I want to send invites to user's facebook friends. For that I use the following code: String KEY_MESSAGE = "message"; Bundle params = new Bundle(); params.putString(KEY_MESSAGE, "Learn how to make your Android apps social"); WebDialog requestsDialog = (new WebDialog.RequestsDialogBuilder(context, Session.getActiveSession(), params)) .setOnCompleteListener(new WebDialog.OnCompleteListener() { @Override public void onComplete(Bundle values, FacebookException error) { if (error == null) { Log.w

Getting 'android.os.NetworkOnMainThreadException' while performing GraphRequest.executeAndWait() in doInBackground() of AsyncTask

非 Y 不嫁゛ 提交于 2019-12-12 04:44:29
问题 I'm using Facebook GraphAPI and I'm trying to load results from next page using GraphRequest.executeAndWait() as demonstrated here, but the app is crashing giving android.os.NetworkOnMainThreadException . Here's my code: class RetrieveF extends AsyncTask<Void, Integer, String> { GraphRequest request; protected String doInBackground(Void...args0) { new GraphRequest( AccessToken.getCurrentAccessToken(), "/me/friends", null, HttpMethod.GET, new GraphRequest.Callback() { public void onCompleted

Facebook SDK 3.0 Android login custom title bar disappears

随声附和 提交于 2019-12-12 03:45:01
问题 When I'm launching the login/register Facebook Activity using the openSession method the application title bar (we're using a custom one) disappears and another one appears. Is there a way to set the custom bar for the new Activity as well? The way I'm calling the Facebook authorization: fb.openSession(this, new Session.StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) { Logger.d(LOGTAG, "Session moved to state " + state.name()); if (null

Facebook Android SDK 4.0+ user_location?

梦想与她 提交于 2019-12-12 03:25:27
问题 I'm trying hard to get User's country but I'm not able to get it. Not able to understand what exactly is wrong here ? I'm referring this documentation. This is what I have tried so far - public interface IFacebokLoginConstants extends ILoginConstants { String KEY_FIRST_NAME = "first_name"; String KEY_LAST_NAME = "last_name"; String KEY_EMAIL = "email"; String KEY_NAME = "name"; String KEY_LOCATION = "location{location}"; String[] READ_PERMISSIONS = {"public_profile", "email", "user_friends",

How can i find my current login status - facebook API android

偶尔善良 提交于 2019-12-12 03:09:48
问题 I am using Facebook Login Button to integrate Facebook Login to my app. When i press Facebook Login Button , it authenticates my Credentials and if successfully done , then change text to Log Out & Go inside my app. Now when i use app and i go out of App and when i again come back to Login Screen. Here i see logout - As i authenticate myself before and i didn't logout. So My question is how to differentiate when i am already logged in or my session is expired ? Here is a code i am using:

Android - Facebook connectivity fails

送分小仙女□ 提交于 2019-12-12 03:01:22
问题 In my Android app, I am integrating the Facebook SDK to have the shareDialog in it. The share dialog open perfectly with the pre-populated details. When I clicked SHARE on top right of sharedialog screen, I am getting the below mentioned error in logcat and in Toast. Please let me know where my config needs correction. Logcat 04-17 15:15:47.140: E/Facebook(14515): Error: com.facebook.FacebookException: Failed to authenticate the application because of app name mismatch. Please check the

Publishing a post with privacy “Public” using Facebook SDK

丶灬走出姿态 提交于 2019-12-12 02:48:40
问题 I am using this code to post an image to the user wall Bundle params = new Bundle(); params.putString("method", "photos.upload"); params.putString( "caption", "Download link"); JSONObject privacy = new JSONObject(); try { privacy.put("value", "EVERYONE"); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } params.putString("privacy", privacy.toString()); byte[] imgData = takeScreenshot(); params.putByteArray("picture", imgData); mAsyncRunner.request(albumId,