mardi 31 mars 2015

Facebook SDK for PHP 5.3 that can work with the Graph API v2.x

I am getting following notification from Facebook every few days.



Your app, is making calls to v1.0 of the Graph API which will be deprecated on Thursday, April 30, 2015. Please upgrade your app to v2.0 or later by that date



I have already updated JavaScript SDK to use v2.0.


my existing Facebook PHP SDK is v.3.1.1


The problem is, latest PHP SDK requires PHP 5.4 or greater. but I am not able to upgrade my existing PHP version 5.3 to 5.4 (my application code is not compatible with PHP 5.4)


is there any other older version of Facebook PHP SDK that I could use, that can work with graph API v2.0 or later and still compatible with PHP 5.3?


Thank You


Vikas


How to crawl dataset from facebook API

I am doing works in data mining research, so I need to use dataset from facebook to do analysis, so here is the question: how can I to get a huge dataset? may contain thousands people...Also need I get these user's permission? I need to crawl thousands' people, so how should I do? Hope to get your help, thank you.


Getting started with facebook sdk android

I m a beginner with android development, and I want to make a test app that allows has a login with Facebook option, I went through all the questions already asked in Stackoverflow and in other websites most of them were outdated and I couldn't grasp the newest ones, so what I m asking for is a step by step tutorial or documentation that teaches that, can anybody help me with that please. And thanks in advance.


Facebook Android SDK ShareDialog doesn't work

I have a strange problem with Facebook Android SDK 4.0. I added all permissions,API_KEY and Hashkeys double checked they are OK. But I can't use ShareDialog on my Real Device which is API 15 and GenyMotion 4.4.4, 4.4.2.


When I try to open ShareDialog it appears without my content. It opens empty on my real device. But it works perfectly on GenyMotion 4.2.1, I tried to open GenyMotion 4.4.4 and 4.4.2 but these emulators don't open Facebook App. They are redirecting me to web view. When I enter my information on the webview I can see my all content so it's working again.


How can it be ? My Real Device doesn't post anything but GenyMotion 4.2.1 does work fine ? What is the problem ?


This is my AndroidManifest.xml;



<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<uses-permission android:name="android.permission.SET_DEBUG_APP"/>

<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />

<application
android:name=".GlobalState"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Vetmapp" >

<provider android:authorities="com.facebook.app.FacebookContentProvider351533225052233"
android:name="com.facebook.FacebookContentProvider"
android:exported="true" />

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/API_KEY" />

<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id"/>

<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:label="@string/app_name" />


This is my Application class;



@Override
public void onCreate() {
super.onCreate();

// Enable Local Datastore.
Parse.enableLocalDatastore(this);

Parse.initialize(this, "KEY", "KEY");

FacebookSdk.sdkInitialize(getApplicationContext());

}


This is my MainActivity.class;



@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
setHasOptionsMenu(true);
return inflater.inflate(R.layout.fragment_harita, container, false);
}

public void onViewCreated(View view, Bundle savedInstanceState){
setupMap();
//showGPSDisableAlert();

FacebookSdk.sdkInitialize(getActivity().getApplicationContext());
callbackManager = CallbackManager.Factory.create();
shareDialog = new ShareDialog(this);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_share) {
if (ShareDialog.canShow(ShareLinkContent.class)) {
ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setContentTitle("VetMapp !")
.setContentDescription(
"Her hayvanseverin telefonunda mutlaka olması gereken bir uygulama, #VetMapp")
.setContentUrl(Uri.parse("http://ift.tt/1DeYi4k"))
.build();

shareDialog.show(linkContent);}


Please help me to solve this problem. Thank you !


Sorry for my bad English.


FBSDKLoginManager logInWithReadPermissions?

I'm using FBSDKLoginButton to allow to user login using Facebook and using FBSDKLoginButton.readPermissions = @[@"public_profile",@"email",@"user_likes",@"email",@"user_birthday"];


to ask for permissions , but I need one more permission which is publish_actions I should use FBSDKLoginManager


with



logInWithReadPermissions:@[@"public_profile",@"user_likes",@"user_birthday"]
logInWithPublishPermissions:@[@"publish_actions"]


but this for some reason affect on my permission "some of my permission are missing check image


Code:-



FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login logInWithPublishPermissions:@[@"publish_actions"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
if (error) {
// Process error
} else if (result.isCancelled) {
// Handle cancellations
} else {
// If you ask for multiple permissions at once, you
// should check if specific permissions missing
if ([result.grantedPermissions containsObject:@"publish_actions"]) {
// Do work
}
}
}];

[login logInWithReadPermissions:@[@"public_profile",@"",@"user_likes",@"user_birthday"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
if (error) {
// Process error
} else if (result.isCancelled) {
// Handle cancellations
} else {
// If you ask for multiple permissions at once, you
// should check if specific permissions missing
if ([result.grantedPermissions containsObject:@"email"]) {
// Do work
}
}
}];


Result:-


**it take long time to redirect the user to the permission view ? and not all my permission appear to user **


enter image description here


Note:- I know that warning mean that i need to submit my app to review but this not what i'm asking about right now .


Facebook SDK v4 and Parse SDK

I have been trying to implement facebook login/signup methods with parse on my app but since the v4 update i haven't been able to. I followed the exact steps provided by both Parse and Facebook but something is not working. I know that Parse SDK contains FacebookUtilsV4.framework but their functions are not working. Has anyone been able to get this working after the V4 update?


Facebook App Invide V4.0 Notification

I upgraded my apps (iOS and Android) to the new Facebook SDK (V4.0) to use the Facebook app invite. (See http://ift.tt/1IvE4Sp).


My problem: when I send an invitation to a Facebook friend he gets a notification if he is using an Android device, but he doesn't get one if he is on iOS (even if he normally receives notifications from Facebook). Despite that, in both cases I can find the invitation in the Facebook app. So the problem is just about the notifications.


Do you know if Facebook has not implemented this part of their API or if I'm doing something wrong?


Thanks for your help.


Error Importing Facebook SDK For Android In Eclipse

I'm facing problem while importing facebook SDK for android in Eclipse. When I import, it shows a lot of errors.


Please help me solve this problem


enter image description here


Get real profile url from Facebook API

Then I try get profile url from Facebook using gem "onmiauth-facebook" I get URL like http://ift.tt/19xrQML How I can get URL like http://ift.tt/1GctTCs from facebook api?


Error while import facebook sdk 4 into android studio project

I'm try to import last facebook sdk into android studio project, but i'm facing some issue. I've solved some of that problems, but there's still some errors (about facebook sdk) that i'm not able to fix. The error is the sequent:



Error:(242, 51) error: diamond operator is not supported in -source 1.6


(use -source 7 or higher to enable diamond operator)


how can i fix it?


Use the Facebook iOS SDK to post an open graph action with a video

I've created a Facebook App for my iOS application and set up the proper app ID and url scheme handling. I've also created an Open Graph Story, with one Action (called "create"), and one Object. The Object is Facebook's Common Type video.other object.


To test using the newest (4.0+) API, I use the following code to post (successfully, just without video content):



NSDictionary *properties = @{
@"og:type": @"video.other",
@"og:title": @"Test title",
};
FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties];

FBSDKShareOpenGraphAction *action = [[FBSDKShareOpenGraphAction alloc] init];
action.actionType = @"myappnamespace:create";
[action setObject:object forKey:@"video:other"];

FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
content.action = action;
content.previewPropertyName = @"video:other";

[FBSDKShareDialog showFromViewController:self withContent:content delegate:self];


Is there a way to attach video data and not simply a URL to a video hosted externally?


wordpress social login plugin: not pulling Facebook frinds list

I'm using the wordpress social login plugin on one of my sites. It's been working perfectly fine for users registering on the site, but it's not pulling their friends/contacts.


As far as I can tell I've followed all the correct setup instructions for both the plugin and my Facebook app. I've scoured both stackoverflow and the plugin support forums for others having the same trouble to no avail.


Basically, when signing up with Facebook, the app is not requesting user_friends as one of it's permissions, which as far as I can tell is pretty much default?


Anyone out there perhaps have an idea of what I may be getting wrong?


LikeView In Android Not Working

`Hello, i am developing an android application using the facebook SDK for android.


i have a LikeView as below



<com.facebook.share.widget.LikeView
android:id="@+id/likeview"
android:layout_width="match_parent"
android:layout_height="match_parent">


The Code ib



LikeView likeView = (LikeView) findViewById(R.id.likeview);
likeView.setObjectIdAndType(
"http://ift.tt/106sCDY",
LikeView.ObjectType.PAGE);


its not working, no window or application opens


can anybody help?


Facebook Integration tutorial for Android Studio 1.0 in 2015

I followed the instructions on the tutorial http://ift.tt/1yCgzDO


but when its time for sync it says that in build.gradle(Project:test) the term apply plugin: 'com.android.library' its not found.. and that android-library is depreciated..


My question is there any tutorial which works? and when we say import facebook sdk we mean import it as module?


Can I estimate the audience size given the city and the language?

I need to mimic the behavior of the targeting selection screen, just make it simpler, limiting the choice to few languages and a few hundred cities, see the picture of the original screen below. I tried calling



curl -G \
-d 'targeting_spec="{"geo_locations":{"countries":["BE"],"zips":[{"key":"BE:1000"}],"locales":[{"key":"1003"}]}}' \
-d 'access_token=TOKEN' \


http://ift.tt/1BRnR4f


but I get the message



{
"error": {
"message": "The entity backed by id ENTITY_ID cannot be seen by the viewer with (ViewerID 0, AccountID 0): DENY_RULE:InlinePrivacyPolicy:AlwaysDenyRule:4 (EntID: ENTITY_ID)",
"type": "OAuthException",
"code": 1
}
}


Should I ask for more permissions from Facebook? And how? I am just trying to build a simple website app.


Facebook Audience targeting


Using the Facebook "Like Button for the Web"

So I've seen a few questions on here about this but none of them have answered my issue. From what I can tell from the Facebook developers page, this should be a simple "plug and chug" scenario. I have placed the "script" code just after "body" and placed the "div class="fb-like" code in the area where I want it to display. I do not see anything show up. I've attempted to look deeper into facebooks documentation but have seen nothing helpful. I am amateur at best when it comes to HTML. Here is a simplified version of how my code is set up.



<!doctype html>

<header>

</header>

<body>

<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-like" data-href="http://ift.tt/1DlBWg3" data-width="200"
data-layout="standard" data-action="like" data-show-faces="true"
data-share="true"></div>

</body>

</html>


Thank you for your time. Here is a link to the directions. http://ift.tt/1jGR5ie


Facebook Graph API - Test User Cannot Access Page Conversations

I'm trying to fetch the conversations from the /conversations endpoint via a page token. Now since the required read_page_mailboxes permission isn't available before review, I'm using the test users for development.


While I'm aware that a test user may not be able to post messages to conversations as specified here http://ift.tt/1woJxTi


I tried to access the pre-created conversations of a page created by a Test User with read_page_mailboxes permission; this however threw an error stating read_mailbox permission was required to access [PAGE-ID]/conversations. So I added the read_mailbox permission to my token process and this time it said


(#298) You must be a developer of the application


Now I tried searching for a way out but as it seems you can not add test users as administrators, so I am unable to test the endpoint.


Finally I decided to use my own real administrator account to test this endpoint but it threw the error


(#210) A page access token is required to request this resource


I debugged the token and it is indeed a page access token, moreover I'm able to use it with the Graph API Explorer (possibly because it has complete permissions.


I'm terribly confused how am I supposed to develop this view and submit the app for review if I cannot even use it.


Any help is appreciated.


Titanium facebook module crash

I am developing a titanium IOS application which uses facebook module for facebook login. I am getting the following error when i close the fb module included window. Can anyone plz help? Thanx in advance.


Error log



[ERROR] : The application has crashed with an uncaught exception 'NSInternalInconsistencyException'.
[ERROR] : Reason:
[ERROR] : An instance 0x17e8aa20 of class FBSessionManualTokenCachingStrategy was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x17d1bd30> (
[ERROR] : <NSKeyValueObservance 0x17dc6850: Observer: 0x17e26170, Key path: accessToken, Options: <New: NO, Old: NO, Prior: YES> Context: 0x538bac, Property: 0x17de0f60>
[ERROR] : <NSKeyValueObservance 0x17d110e0: Observer: 0x17e26170, Key path: expirationDate, Options: <New: NO, Old: NO, Prior: YES> Context: 0x538bac, Property: 0x17d1bd10>
[ERROR] : )
[ERROR] : Stack trace:
[ERROR] :
[ERROR] : 0 CoreFoundation 0x29ff549f <redacted> + 126
[ERROR] : 1 libobjc.A.dylib 0x377abc8b objc_exception_throw + 38
[ERROR] : 2 CoreFoundation 0x29ff53e5 <redacted> + 0
[ERROR] : 3 Foundation 0x2ac9ec25 <redacted> + 288
[ERROR] : 4 libobjc.A.dylib 0x377c5d5f <redacted> + 166
[ERROR] : 5 Qatar Tips 0x0047130b Qatar Tips + 4375307
[ERROR] : 6 libobjc.A.dylib 0x377c5d5f <redacted> + 166
[ERROR] : 7 Qatar Tips 0x0046e3a5 Qatar Tips + 4363173
[ERROR] : 8 libobjc.A.dylib 0x377c5d5f <redacted> + 166
[ERROR] : 9 Qatar Tips 0x0006e76f Qatar Tips + 169839
[ERROR] : 10 libobjc.A.dylib 0x377c5d5f <redacted> + 166
[ERROR] : 11 Qatar Tips 0x0006cf71 Qatar Tips + 163697
[ERROR] : 12 Qatar Tips 0x002ace57 Qatar Tips + 2522711
[ERROR] : 13 Qatar Tips 0x0042b65f Qatar Tips + 4089439
[ERROR] : 14 Qatar Tips 0x0042d4c9 Qatar Tips + 4097225
[ERROR] : 15 Qatar Tips 0x00354cf7 Qatar Tips + 3210487
[ERROR] : 16 Qatar Tips 0x00356bf5 Qatar Tips + 3218421
[ERROR] : 17 Qatar Tips 0x00355acf Qatar Tips + 3214031
[ERROR] : 18 Qatar Tips 0x00262927 Qatar Tips + 2218279
[ERROR] : 19 Qatar Tips 0x0026256f Qatar Tips + 2217327
[ERROR] : 20 Qatar Tips 0x002ab5d5 Qatar Tips + 2516437
[ERROR] : 21 Qatar Tips 0x000659af Qatar Tips + 133551
[ERROR] : 22 Qatar Tips 0x00067a8d Qatar Tips + 141965
[ERROR] : 23 Foundation 0x2ad05b5b <redacted> + 1118
[ERROR] : 24 libsystem_pthread.dylib 0x37e6ee93 <redacted> + 138
[ERROR] : 25 libsystem_pthread.dylib 0x37e6ee07 _pthread_start + 118
[ERROR] : 26 libsystem_pthread.dylib 0x37e6cb90 thread_start + 8
[ERROR] : *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x17e8aa20 of class FBSessionManualTokenCachingStrategy was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x17d1bd30> (
[ERROR] : <NSKeyValueObservance 0x17dc6850: Observer: 0x17e26170, Key path: accessToken, Options: <New: NO, Old: NO, Prior: YES> Context: 0x538bac, Property: 0x17de0f60>
[ERROR] : <NSKeyValueObservance 0x17d110e0: Observer: 0x17e26170, Key path: expirationDate, Options: <New: NO, Old: NO, Prior: YES> Context: 0x538bac, Property: 0x17d1bd10>
[ERROR] : )'
[ERROR] : *** First throw call stack:
[ERROR] : (0x29ff549f 0x377abc8b 0x29ff53e5 0x2ac9ec25 0x377c5d5f 0x47130b 0x377c5d5f 0x46e3a5 0x377c5d5f 0x6e76f 0x377c5d5f 0x6cf71 0x2ace57 0x42b65f 0x42d4c9 0x354cf7 0x356bf5 0x355acf 0x262927 0x26256f 0x2ab5d5 0x659af 0x67a8d 0x2ad05b5b 0x37e6ee93 0x37e6ee07 0x37e6cb90)


My window closing code



SubCategoryWindow.addEventListener('android:back', _androidBack);
function _androidBack(e) {
bottomAdvertisementInterval = null;
categoryId = null;
SubCategoryWindow.removeEventListener('android:back', _androidBack);
SubCategoryWindow.hide();
SubCategoryWindow = null;
LoadingIndicator = null;
itemId = null;
ImageCacheModule = null;
fbShareBlob = null;
}

Facebook4J Facebook API getFeed() returning wrong output

I'm using Facebook4J and last week the Facebook Graph API was updated to version 2.3.0. Some code I wrote before the update doesn't work anymore. I'm trying to get the amount of feeds of a certain page. I've set the max to 250. A week ago it returned about 180, but since the Graph update it always returns 220. But in last week the page didn't post another 40 feeds.


Here you can see the raw code I used to get the amount of feeds of the page. I even tried it with different pages, but everything returns 220.



public static void main(String[] args) throws FacebookException
{
String name = "pagename";
ResponseList<Post> feeds = facebook.getFeed(name, new Reading().limit(250));
System.out.println(feeds.size());
}


As you can see above, I left out the part of the accesstoken. Does somebody know what the problem is? And why I get a wrong output with exactly thesame code as a week ago?


Android Login with Facebook SDK 4.0

I hope anybody can help me ! I want to change my code for the new facebook sdk 4.0 but there is only a little description and i´m getting crazy and don´t know how to make the new code with facebook login button and accesstoken


target of this code is that the user logs in with his facebook account and checks if the user already exits. if not then insert new user with email and facebook id and name


I have marked the codes with //needs to be changed and //needs to be changed END


Thanx in advance for any help !!!





import com.facebook.AccessToken;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.login.LoginResult;
import com.facebook.login.widget.LoginButton;
// import com.facebook.Request;
//import com.facebook.Request.GraphUserCallback;
// import com.facebook.Response;
// import com.facebook.Session;
// import com.facebook.SessionState;
//import com.facebook.UiLifecycleHelper;
// import com.facebook.model.GraphUser;
// import com.facebook.widget.LoginButton;

@SuppressLint("NewApi")
public class AuthenticationFragment extends Fragment {
LoginButton facebookLoginButton;
// private UiLifecycleHelper uiHelper;
String TAG = "Fragment";
Button btnLogin, btnCreateAccount;
ProgressDialog dialogPrg;
String userName = null;

// New Facebook Added
CallbackManager callbackManager;


public static final AuthenticationFragment newInstance() {
// TODO Auto-generated constructor stub
AuthenticationFragment fragment = new AuthenticationFragment();
return fragment;
}

@Override
public void onAttach(Activity activity) {
// TODO Auto-generated method stub
super.onAttach(activity);
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
View view = inflater.inflate(R.layout.authentication_layout, container,
false);
facebookLoginButton = (LoginButton) view
.findViewById(R.id.btnFacebookLogin);
facebookLoginButton.setFragment(this);
facebookLoginButton.setReadPermissions(Arrays.asList("email"));


// New added for Facebook

// Callback registration
facebookLoginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
// App code

//login ok get access token
AccessToken.getCurrentAccessToken();


}

@Override
public void onCancel() {
// App code



Log.i(TAG, "facebook login canceled");
}

@Override
public void onError(FacebookException exception) {
// App code

Log.i(TAG, "facebook login failed error");
}
});
//New added for Facebook END






btnLogin = (Button) view.findViewById(R.id.btn_login);
btnCreateAccount = (Button) view.findViewById(R.id.btn_create_account);
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), LoginActivity.class);
startActivity(intent);
}
});
btnCreateAccount.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent(getActivity(),
CreateAccountActivity.class);
startActivity(intent);
}
});
dialogPrg = new ProgressDialog(getActivity());
dialogPrg.setCanceledOnTouchOutside(false);
return view;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);


// uiHelper = new UiLifecycleHelper(getActivity(), callback);
// uiHelper.onCreate(savedInstanceState);



}







// Needs to be changed

private Session.StatusCallback callback = new Session.StatusCallback() {
@Override
public void call(final Session session, final SessionState state,
final Exception exception) {
onSessionStateChange(session, state, exception);
}
};

// Needs to be changed END



private void onSessionStateChange(Session session, SessionState state,
Exception exception) {
if (state.isOpened()) {
Log.i("FB AUT FRAGMENT", "Logged in...");
} else if (state.isClosed()) {
Log.i("FB AUT FRAGMENT", "Logged out...");
}
}


// Needs to be changed

private void insertUser(Session session) {
Request.newMeRequest(session, new GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
// TODO Auto-generated method stub
new facebookUserCheck(user).start();
}
}).executeAsync();
}

// Needs to be changed END


// Needs to be changed

private class facebookUserCheck extends Thread {
GraphUser user;

public facebookUserCheck(GraphUser user) {
// TODO Auto-generated constructor stub
this.user = user;
}

// Needs to be changed



@Override
public void run() {
// TODO Auto-generated method stub
super.run();
// TODO Auto-generated method stub
String handleInsertUser = getActivity().getResources().getString(
R.string.users_json_url)
+ "facebook_user_check";
try {
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(handleInsertUser);
MultipartEntity reqEntity = new MultipartEntity();


// Needs to be changed user.getId

reqEntity.addPart("fb_id", new StringBody(user.getId()));
// Needs to be changed END


post.setEntity(reqEntity);
HttpResponse res = client.execute(post);
HttpEntity resEntity = res.getEntity();
final String response_str = EntityUtils.toString(resEntity);
if (resEntity != null) {
Log.i(TAG, response_str);
getActivity().runOnUiThread(new Runnable() {
public void run() {
try {
dialogPrg.dismiss();
JSONArray jsonArray = new JSONArray(
response_str);
if (jsonArray.length() == 1) {
JSONObject obj = jsonArray.getJSONObject(0);
User user = Ultils.parseUser(obj);
UserSessionManager userSession = new UserSessionManager(
getActivity());
userSession.storeUserSession(user);
Intent intent = new Intent(getActivity(),
HomeActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK
| Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
} catch (Exception e) {
LayoutInflater inflater = LayoutInflater
.from(getActivity());
View promptsView = inflater.inflate(
R.layout.username_promtps_layout, null);

AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
getActivity());

// set prompts.xml to alertdialog builder
alertDialogBuilder.setView(promptsView);

final EditText message = (EditText) promptsView
.findViewById(R.id.editTextDialogUserInput);
alertDialogBuilder
.setMessage(getResources().getString(
R.string.choose_your_user_name));
// set dialog message
alertDialogBuilder
.setCancelable(false)
.setPositiveButton(
getResources().getString(
R.string.ok_label),
new DialogInterface.OnClickListener() {
public void onClick(

DialogInterface dialog,
int id) {
if (!Validator
.validUserName(message
.getText()
.toString())) {
showDialog(getResources()
.getString(
R.string.invalid_user_name));
return;
}
userName = message
.getText()
.toString();
new facebookUserRegister(
user).start();
}
});

// create alert dialog
AlertDialog alertDialog = alertDialogBuilder
.create();

// show it
alertDialog.show();
}
}
});
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
}

// Needs to be changed

private class facebookUserRegister extends Thread {
GraphUser user;

public facebookUserRegister(GraphUser user) {
// TODO Auto-generated constructor stub
this.user = user;
}

// Needs to be changed END



@Override
public void run() {
super.run();
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
dialogPrg.show();
}
});
String handleInsertUser = getActivity().getResources().getString(
R.string.users_json_url)
+ "facebook_user_register";
try {
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(handleInsertUser);
MultipartEntity reqEntity = new MultipartEntity();


// Needs to be changed user.getId, user.getName, user.asMap

reqEntity.addPart("fb_id", new StringBody(user.getId()));
reqEntity.addPart("fullname", new StringBody(user.getName()));
reqEntity.addPart("email", new StringBody(user.asMap().get("email").toString()));
// Needs to be changed END


reqEntity.addPart("username", new StringBody(userName));
post.setEntity(reqEntity);
HttpResponse res = client.execute(post);
HttpEntity resEntity = res.getEntity();
final String response_str = EntityUtils.toString(resEntity);
if (resEntity != null) {
Log.i(TAG, response_str);
getActivity().runOnUiThread(new Runnable() {
public void run() {
try {
dialogPrg.dismiss();
JSONObject jsonObj = new JSONObject(
response_str);
if (jsonObj.getString("ok").equals("0")) {
// show error email;
showDialog(getActivity().getResources()
.getString(R.string.email_exist));
return;
}

if (jsonObj.getString("ok").equals("1")) {
// show error username
showDialog(getActivity()
.getResources()
.getString(R.string.user_name_exist));
return;
}

if (jsonObj.getString("ok").equals("2")) {
// show unknow username
showDialog(getActivity().getResources()
.getString(R.string.login_failed));
return;
}

} catch (Exception e) {
JSONArray jsonArray;
try {
jsonArray = new JSONArray(response_str);
if (jsonArray.length() == 1) {
JSONObject obj = jsonArray
.getJSONObject(0);
User user = Ultils.parseUser(obj);
UserSessionManager userSession = new UserSessionManager(
getActivity());
userSession.storeUserSession(user);
Intent intent = new Intent(
getActivity(),
HomeActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK
| Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
} catch (JSONException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
showDialog(getActivity().getResources()
.getString(R.string.login_failed));
}

}
}
});
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
}


// Needs to be changed

@Override
public void onResume() {
super.onResume();


Session session = Session.getActiveSession();
if (session != null && (session.isOpened() || session.isClosed())) {
onSessionStateChange(session, session.getState(), null);
}

// uiHelper.onResume();
}

// Needs to be changed END



@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

// New Facebook added
callbackManager.onActivityResult(requestCode, resultCode, data);
//New Facebook added END



// uiHelper.onActivityResult(requestCode, resultCode, data);


// Needs to be changed

if (Session.getActiveSession() != null
&& Session.getActiveSession().isOpened()) {
dialogPrg.setMessage(getActivity().getResources().getString(
R.string.loging));
dialogPrg.show();
facebookLoginButton.setEnabled(false);
insertUser(Session.getActiveSession());
}
}
// Needs to be changed END





@Override
public void onPause() {
super.onPause();
// uiHelper.onPause();

}

@Override
public void onDestroy() {
super.onDestroy();
// uiHelper.onDestroy();
}

@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
// uiHelper.onSaveInstanceState(outState);
}

public void showDialog(String message) {
Ultils.logout(getActivity());
AlertDialog.Builder buidler = new AlertDialog.Builder(getActivity());
buidler.setMessage(message);
buidler.setPositiveButton(
getActivity().getResources().getString(R.string.ok_label),
new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method
// stub
facebookLoginButton.setEnabled(true);
}
});
AlertDialog dialog = buidler.create();
dialog.show();
}

}



SonataMediaBundle create FacabookImageProvider

AVAILABLE SERVICES


default providers



sonata.media.provider.image : Image
sonata.media.provider.file : File


etc


May be somebody created sonata.media.provider.facebook_image ?


facebook share on page you manage in asp.net mvc

i am trying to share product details in facebook from our website in asp mvc, i used feed dialog and it works fine, but i need and additional options in feed dialog to share on page you manage


feed dialog



<a href="http://ift.tt/1GItQ27" target="_blank"><div style="width:60px;float:left;"><img style="text-align:center" src="@Url.Content("~/image/fbshare.jpg")" alt="fbshare" /></div></a>


didn't work, so i tried sharer.php



<a target="_blank" href="http://ift.tt/1NySSRe"><div style="width:60px;float:left;"><img style="text-align:center" src="@Url.Content("~/image/fbshare.jpg")" alt="fbshare" /></div></a>


but when i share using sharer.php it shares my site login Page, our product site is login based, users can view all products , but when they click buy , they have to login to proceed further.


i dont know, why does facebook share my login Page instead of product details ?


How can i provide options like share on page you manage, timeline , friends etc ?


enter image description here


its been hours, i couldn't find any solution still, any help would be great.


Is it possible to use Facebook OG tag in an tag in the body of a page?

In a WordPress site I'm building, I'd ideally like to make the first post image the og:image for that page. I don't yet know what that image is when the header is called, however.


Is there a way to specify the og:image within the <img> tag itself, or somewhere else in the <body>?


Is there any common unique id or variable existing in Facebook and Twitter (like email)?

Is there any common unique id or variable existing in Facebook and Twitter like email id? .Currently i developing a social game ,which can login with Facebook , Twitter and using email id.


Problem is


1.Facebook provide email but Twitter 2.Facebook and Twitter provides id , but both are different not same value


Facebook SDK 4 - Get user data

I followed an online tutorial which almost works. The code looks something like this. Tried using the require_once __DIR__ . "/Facebook/autoload.php"; but it returns Fatal error: Class 'Facebook\FacebookSession' not found.


Edit ** Added the autoload.php like suggested.



session_start();

require __DIR__ . "/facebook-php-sdk-v4-4.0-dev/autoload.php";
/*
require_once( ''.__DIR__.'/facebook-php-sdk-v4-4.0-dev/src/Facebook/HttpClients/FacebookHttpable.php' );
require_once( ''.__DIR__.'/facebook-php-sdk-v4-4.0-dev/src/Facebook/HttpClients/FacebookCurl.php' );
require_once( ''.__DIR__.'/facebook-php-sdk-v4-4.0-dev/src/Facebook/HttpClients/FacebookCurlHttpClient.php' );

require_once( ''.__DIR__.'/facebook-php-sdk-v4-4.0-dev/src/Facebook/Entities/AccessToken.php' );
require_once( ''.__DIR__.'/facebook-php-sdk-v4-4.0-dev/src/Facebook/Entities/SignedRequest.php' );

require_once( ''.__DIR__.'/facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookSession.php' );
require_once( ''.__DIR__.'/facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookRedirectLoginHelper.php' );
require_once( ''.__DIR__.'/facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookRequest.php' );
require_once( ''.__DIR__.'/facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookResponse.php' );
require_once( ''.__DIR__.'/facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookSDKException.php' );
require_once( ''.__DIR__.'/facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookRequestException.php' );
require_once( ''.__DIR__.'/facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookOtherException.php' );
require_once( ''.__DIR__.'/facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookAuthorizationException.php' );
require_once( ''.__DIR__.'/facebook-php-sdk-v4-4.0-dev/src/Facebook/GraphObject.php' );
require_once( ''.__DIR__.'/facebook-php-sdk-v4-4.0-dev/src/Facebook/GraphSessionInfo.php' );
*/

use Facebook\HttpClients\FacebookHttpable;
use Facebook\HttpClients\FacebookCurl;
use Facebook\HttpClients\FacebookCurlHttpClient;

use Facebook\Entities\AccessToken;
use Facebook\Entities\SignedRequest;

use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookAuthorizationException;
use Facebook\GraphObject;
use Facebook\GraphUser;
use Facebook\GraphSessionInfo;
use Facebook\GraphLocation;
use Facebook\FacebookOtherException;

$appId = 'xxx';
$appSecret = 'xxx';
$redirect_url = 'http://ift.tt/1ugFUSs';

//initialize Facebook
FacebookSession::setDefaultApplication($appId, $appSecret);
$helper = new FAcebookRedirectLoginHelper($redirect_url);

try {
$session = $helper->getSessionFromRedirect();
} catch(FacebookRequestException $ex) {
die(" Error : " . $ex->getMessage());
} catch(\Exception $ex) {
die(" Error : " . $ex->getMessage());
}

var_dump($_SESSION['fb_token']); //Notice: Undefined index: fb_token

if ( isset( $_SESSION ) && isset( $_SESSION['fb_token'] ) ) {
$session = new FacebookSession($_SESSION['fb_token']);
}

if($session) {

//store token in php session
$_SESSION['fb_token'] = $session->getToken();

try {

$user = (new FacebookRequest(
$session, 'GET', '/me'
))->execute()->getGraphObject(GraphUser::className())->asArray();

} catch(FacebookRequestException $e) {

}

$name = $user['name'];
$firstName = $user['first_name'];
$lastName = $user['last_name'];
$fbId = $user['id'];
$fbEmail = $user['email'];

}else{
echo "No session!";
}


This is the login url which is located in the header on every page. I won't include the whole code, but the below is only seen by visitors who aren't logged in:



<?php
echo '<li class=" fb right"><a href="'.$helper->getLoginUrl().'" ><img style="height: 29px;" src="img/login_fb.png" alt="Facebook Log in" /></a> </li>';
?>


Login url:



if( isset($_SESSION['fb_token']) ) {
//do stuff with user info
}else{
echo "no token";
}



  • Sometimes the fb_token doesn't set. When someone clicks on the login url, they are redirected to the login page with the no token message. If the login url is clicked again while on the login page, everything works.


Edit **



  • For some reason now it's not detecting the fb_token at all. Even when I'm logged into Facebook. Which is very weird because I never had this problem until now.


Facebook album bug

I need to post the image in the "Timeline Photos" album but if doesn't exist how I can do ? Because the "timeline photos" have a different properties between any other album. This is the main part of code:



[FBRequestConnection startWithGraphPath:@"/me/albums"
parameters:nil
HTTPMethod:@"GET"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
) {

NSLog(@"%@",error);

if (!error) {
NSArray *feed =[result objectForKey:@"data"];
for (NSDictionary *dict in feed) {
if ([dict[@"name"] isEqualToString:@"Timeline Photos"]){
album = dict[@"id"];

}
}


This is the error:



FB Error:Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x7ba17220 {com.facebook.sdk:HTTPStatusCode=404, com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 803;
message = "(#803) Some of the aliases you requested do not exist: (null)";
type = OAuthException;
};
};
code = 404;
}, com.facebook.sdk:ErrorSessionKey=<FBSession: 0x7bacb810, state: FBSessionStateOpen, loginHandler: 0x7a6931b0, appID: 399467806871018, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0x7bab6bd0>, expirationDate: 2015-05-30 12:07:56 +0000, refreshDate: 2015-03-31 12:07:57 +0000, attemptedRefreshDate: 0000-12-30 00:00:00 +0000, permissions:(
"public_profile",
email,
"publish_actions",
"user_photos",
"user_friends"
)>}

Facebook Dialog in android Not coming up

i am developing android application where i am using facebook SDK for android.


i want to use the facebook share dialog



ShareLinkContent content = new ShareLinkContent.Builder()
.setContentUrl(Uri.parse("http://ift.tt/I37asW"))
.build();


when i run the application nothing happens, no dialog appears, no errors


can anybody help?


facebookConnectPlugin is not defined on second call (cordova 3.7, android)

I am building a cordova app, I integrated facebook sdk successfully using facebook plugin, able to call "facebookconnectplugin" only once without destroying app.


I am calling "facebookconnectplugin" at a example.html page, it works fine, now I am logged in. when i navigate to other page abc.html and after coming back to example.page it is showing me error "facebookConnectPlugin is not defined". js is present there.


when i destroy the app then again everything works fine on first time.


Facebook friends which have are using your app

I'm developing an Android application and I encountered the following issue :


I'm querying Facebook for getting the list of my Facebook friends which are using the application. If we are not friends within the application, I can add them to my list of friends.


This is the request I make to Facebook in order to get the friends :



private Request createRequest(Session session) {
Request request = Request.newGraphPathRequest(session, "me/friends", null);

Set<String> fields = new HashSet<String>();
String[] requiredFields = new String[]{"id", "name", "picture", "installed", "first_name"};
fields.addAll(Arrays.asList(requiredFields));

Bundle parameters = request.getParameters();
parameters.putString("fields", TextUtils.join(",", fields));
request.setParameters(parameters);

return request;
}


If I install the app once, data will be stored on Facebook in the app section, I assume that's how the query works. Problem is if I uninstall the application from my phone, data will still be available on Facebook and I will still get that friend in the list of Facebook friends using my application, although he is not using it anymore.


I could do a check against my database with the response Facebook provides, but it's not really optimal: in case I have 20 Facebook friends and 10000 users in the application, I will have to check each entry.


Is there a way to handle this properly?


Android, Sudden error with com.facebook, cannot resolve all symbols

I was developing application imported from Eclipse with facebook library. For two months everything was ok, today I opened Android Studio and suddenly all facebook library cannot be solved... I don't remember that I did something what could cause this. I updated SDk Manager, deleted and install again facebook library, but still no change.


gradle:



apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.name.app"
minSdkVersion 19
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'com.android.support:recyclerview-v7:21.0.3'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
}


Errors:



Error:(33) No resource identifier found for attribute 'fetch_user_info' in package 'com.name.app'
Error:Execution failed for task ':app:processDebugResources'.com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Beata\AppData\Local\Android\sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1


in LoginActivity all these symbols cannot be solved:



import com.facebook.Session;
import com.facebook.SessionState;
import com.facebook.UiLifecycleHelper;
import com.facebook.model.GraphUser;
import com.facebook.widget.LoginButton;


If I comment all code connected to facebook, the rest app works fine. What could cause this problem? How can I fix this?


Reading user posts using Facebook API

I'm traying to read user posts using Facebook API.


Everithing is ok and I can read all public user posts when api call is made using v1.0 api version:


http://ift.tt/1m0clLW{user_id}/posts?fields=message,name,description,type&access_token={access_token}


But when api call is made using v2.3 version (or any other 2.x version) facebook returns empty list:


http://ift.tt/1Gbzide{user_id}/posts?fields=message,name,description,type&access_token={access_token}


Both requests was made for the same user with the same access token. Can anyone explain such behavior?


FBSDKLoginManager logInWithPublishPermissions always returns isCancelled=YES

I am having trouble figuring out how to log a user into my app. [FBSDKAccessToken currentAccessToken] is nil, so I am calling:



[[[FBSDKLoginManager alloc] init] logInWithPublishPermissions:@[@"publish_actions"] handler:…];


as per the included sample project. This switches to the Facebook app, but the message says "You have already authorized App Name.". I click OK and it goes back into the app, but grantedPermissions and declinedPermissions are both nil on the result, and isCancelled is YES. [FBSDKAccessToken currentAccessToken] is still nil.


I can't figure out how I'm supposed to get currentAccessToken to be filled in. It seems to me the call to logInWithPublishPermissions should do that, but it isn't.


Facebook AccessToken.getAccessToken is null on opening of app even after first login

I have integrated latest Facebook android sdk (Sdk 4.0). This is the code I have added in my onCreate method.



FacebookSdk.sdkInitialize(this.getApplicationContext());
callbackManager = CallbackManager.Factory.create();
if(AccessToken.getCurrentAccessToken()!=null){
Log.d(FBTAG,"facebook already logged in");
isFBLogin = true;
}
LoginManager.getInstance().registerCallback(callbackManager,
new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
// App code
Log.d(FBTAG,"facebook log in");
isFBLogin = true;
}

@Override
public void onCancel() {
// App code
isFBLogin = false;
}

@Override
public void onError(FacebookException error) {
isFBLogin = false;
Log.d(FBTAG,"facebook login error: "+error);
// App code

}
});


And this is the code I have used for onClickLogin



public void onClickLogin() {
LoginManager.getInstance().logInWithPublishPermissions(this, PERMISSIONS);
}


I am able to login by clicking on the login button and processing onClickLogin function. Now next time I am opening the app the app I am checking for AccessToken.getAccessToken to check if the user is already logged in at facebook but it is always coming as null. Isn't there anyway in the new sdk to login in the background so that I don't have to ask the user to login always like it used to be in the previous version in session class.


Facebook pmd system: Given URL is not allowed by the Application configuration

We are developing a Facebook PMD system,but when we upload the link through API,we get this error:'Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains' . We did what people say: add link in Site URL and the issue was solved. But since we are a PMD system,it should allow different users to add different links in our system.But 'Site URL' can only add one link. What should we do?


show shared image as thumbnail in facebook sharing in Laravel

I am trying to add share button to albums in website created in Laravel. I have used the code for share button that generated using facebook/developer. The albums are not fixed. It is displaying by fetching from database. So I changed code little to change the link of each album automatically as given below.



<div class="fb-share-button" data-href="http://mysite/albumphotos/{{$album->name}}" data-layout="button">
</div>


But if I try to share into my facebook account, it is showing some other images in my website. How can I show images in my particular album as thumbnail while sharing??


Can anyone help?


Could not initialize LoginButton Facebook-sdk for android

im working on an android project an i want to put a Facebook Login feature, i added the Facebook sdk Correctly but i could not initialize LoginButton



**java.lang.NoClassDefFoundError: Could not initialize class com.facebook.login.widget.LoginButton**
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:413)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:105)
at com.android.tools.idea.rendering.LayoutlibCallback.loadView(LayoutlibCallback.java:176)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:132)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:806)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:400)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:332)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:708)
at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:697)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:932)
at com.android.tools.idea.rendering.RenderService.createRenderSession(RenderService.java:697)
at com.android.tools.idea.rendering.RenderService.render(RenderService.java:816)
at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$6.run(AndroidDesignerEditorPanel.java:480)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:327)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)


here is my AppManifest.xml :



<?xml version="1.0" encoding="utf-8"?>



<uses-permission android:name="android.permission.INTERNET"/>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >

<activity
android:name=".helloActivity"
android:label="@string/title_activity_hello" >
</activity>

<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:label="@string/app_name" />
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id"/>
</application>


I specified the App_id in Strings.xml. Thanks for help


Any Example showing how to login using Facebook SDK 4.0 in Android either by using own button or Facebook Button?

Is there any tutorial or example showing how to login using own Button using Facebook SDK 4.0 in Android? I am not getting anywhere and using facebook developers site it is difficult to understand.Like below when calling FBlogin button I want to check go for login if user has not logged in or if logged in I want the access token to get facebook profile information and user likes.



FBlogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Facebook login Code to get profile info and user likes
}
});


I have tried also loginButton Facebook.



<com.facebook.login.widget.LoginButton
android:id="@+id/login_button"
android:layout_width="244dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:layout_marginBottom="30dp"

/>


But it is showing error in xml :-



java.lang.NoClassDefFoundError: Could not initialize class com.facebook.login.widget.LoginButton
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:413)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:105)
at com.android.tools.idea.rendering.LayoutlibCallback.loadView(LayoutlibCallback.java:176)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:206)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:131)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:739)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:711)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:372)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:369)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:326)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:708)
at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:697)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:932)
at com.android.tools.idea.rendering.RenderService.createRenderSession(RenderService.java:697)
at com.android.tools.idea.rendering.RenderService.render(RenderService.java:816)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:646)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1700(AndroidLayoutPreviewToolWindowManager.java:82)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7$1.run(AndroidLayoutPreviewToolWindowManager.java:589)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7.run(AndroidLayoutPreviewToolWindowManager.java:584)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:327)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)


My Activity class:-



protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FacebookSdk.sdkInitialize(getApplicationContext());
setContentView(R.layout.activity_main);


Ia there any example/tutorial to login using facebook sdk4.0? I am stuck in both way. Please help.


Facebook's inApp browser crashes when trying to upload photos in a form

I've got a registration form on a website that requires users to upload photos of themselves. We're sending the link to this form on Facebook, and most of our users open it on mobile, via the inApp web browser of the Facebook App.


I tried to debug the problem with several devices and operating systems:


iOS 7&8: When clicking on the input field, the dialog to use camera or existing images shows up. Whatever I click, the InApp browser crashes, and I can't visit the link until the FB app is restarted.


Android 4.3: The InApp browser doesn't crash, but no dialog box comes up whatsoever. So when the user click on the file upload field, nothing happens.


I tried to insert a script which detects if the form is opened by the Facebook InApp browser and redirect to a _blank page (for it to open in the browser), but that doesn't work either, and I'm out of options.


It's not really an option to output a message to the user that he/she has to open the form in a browser.


Is there an easy way to fix this apart from these?


Edit: The problem doesn't occur in the FB Messenger app, only with the normal FB app.


Apple is rejecting app with only facebook integration

We have an app that forces facebook login. The reason we have done so is because its a kind of community forum where user can share the ride or look for people around who is interested in doing so. However, Apple is asking us to have our own login but we do not want to do so considering the overhead involved in maintaining the user database. And also we cannot make a good community by having our own login from day one.


So, can we have an app which has forced facebook or google plus login in iOS?


Single facebook api url for cross domain jquery clients

I am making a jquery menu containing a custom facebook share button that is pulled from my domain and runs on any client. In this case, how do I register the url within the api?


For example, if there are 100+ clients pulling my script, do I need to register each of the 100+ clients urls within the facebook api, or is there a way to handle this?


Unable to publish picture to facebook from android app

I've write this code for share a screenshot of current view on user facebook account. This is how i take screenshot



private File captureScreen() {

Bitmap screenshot = null;
try {

if (view != null) {

screenshot = Bitmap.createBitmap(view.getMeasuredWidth(),
view.getMeasuredHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(screenshot);
view.draw(canvas);
// save pics
File cache_dir = Environment.getExternalStorageDirectory();
Log.i("SCREEN", "cache dir:" + cache_dir);
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
screenshot.compress(Bitmap.CompressFormat.PNG, 90, bytes);
File f = new File(cache_dir + File.separator + "screen.png");
f.createNewFile();
FileOutputStream fo = new FileOutputStream(f);
fo.write(bytes.toByteArray());
fo.close();
return f;
}

} catch (Exception e) {
// TODO
}

return null;
}


and this is how i share screenshot



BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap bitmap = BitmapFactory.decodeFile(captureScreen()
.getAbsolutePath(), options);
if (bitmap != null) {
Request uploadRequest = Request.newUploadPhotoRequest(
Session.getActiveSession(), bitmap,
new Request.Callback() {
@Override
public void onCompleted(Response response) {
Toast.makeText(getActivity(),
"Photo uploaded successfully",
Toast.LENGTH_LONG).show();
}
});
uploadRequest.executeAsync();


Now toast of success is showed, but no picture is uploaded to my facebook profile. (my app is not public yet on facebook, but i am the owner, so i can perform all actions)


How can I fetch data from facebook events using graph API

I want to fetch data from a facebook event using graph API. I wrote the following code :



<?php
$url = 'http://ift.tt/1EN8azF';
$contents = file_get_contents( $url );
if( $contents )
{
$data = json_decode( $contents, true );
echo '<pre>';
print_r( $data );
echo '</pre>';
}
?>


My event page address URL is http://ift.tt/1EN8aPT. The above code is not working properly. When I am using the same code for a page,e.g., http://ift.tt/1DTdKmp , it works fine.



<?php
$url = 'http://ift.tt/1DTdLqk';
$contents = file_get_contents( $url );
if( $contents )
{
$data = json_decode( $contents, true );
echo '<pre>';
print_r( $data );
echo '</pre>';
}
?>


Also, I am unable to run it on localhost. Please help me to solve this or please tell me any other method to solve this.


Get facebook user profile data, android?

I have integrated facebook login in my app. It works fine and in the callback method I get



Access token as: {AccessToken token:ACCESS_TOKEN_REMOVED permissions:[user_friends, basic_info]}


I was looking for on how to get the user's data from FB PROFILE DATA


But it asks for a seesion. From where do I get the session?


Error in integrating Parse and Facebook into Android app

I am trying to integrate Parse and Facebook into my app. When I want to make the Facebook login I get this error:



java.lang.NoClassDefFoundError: com.facebook.android.Facebook


The code I use to initialize my Parse and ParseFacebookUtils:



public class App extends Application {
public static Bitmap profilePicture;

private static String PARSE_APPLICATION_ID;
private static String PARSE_CLIENT_KEY;

@Override
public void onCreate() {
super.onCreate();

PARSE_APPLICATION_ID = getResources().getString(R.string.PARSE_APPLICATION_ID);
PARSE_CLIENT_KEY = getResources().getString(R.string.PARSE_CLIENT_KEY);

Parse.enableLocalDatastore(this);
Parse.initialize(this, PARSE_APPLICATION_ID, PARSE_CLIENT_KEY);

ParseFacebookUtils.initialize();

}
}


I included Parse-1.9.0.jar and ParseFacebookUtilsV3-1.9.0.jar in my app. If someone could help me that would be great!


Is there any repository to download Facebook dummy data for analytics?

Is there any repository to download Facebook dummy data containing user Profile info and facebook likes for data analytics testing?


Facebook app notification template with user id ( @[user_id] ) not working

I can't get the @[user_id] template to work using:



$userid = <USER_ID>;
$friendId = <FRIEND_ID>; // This is a user who has accepted the app
$url = "http://ift.tt/1Bhlqca";
$attachment = array(
'access_token' => "$app_token",
'href' => "",
'template' => "@[" . $friendId . "] accepted challenge!"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
//curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$result = curl_exec($ch);
curl_close ($ch);


$result returns 'false'


$friendId is a valid app user and $app_token is "appid|appsecret"


If I replace 'template' with a simple message such as "test" it all works fine


Any ideas?


Accessing Facebook Videos in my App

Is there a way I can browse a Facebook page's videos? I have been able to browse photo albums with help of an online tutorial but not videos. Is that even possible? Any help would greatly be appreciated. Thanks


Create a Facebook tab with PHP

I want to know if it is possible to create a Facebook page tab with an iFrame for users of my website.


An user comes on my website and creates some kind of content. Now i want to have some kind of functionality that the user clicks on a button and then the code will automatically create a Facebook page tab on there Facebook page with an iFrame code (linked to my website).


I did some research on it and i couldn't find something that would do the job..


So my question is: is this possible? And if this is possible do somebody has a link to some kind of documentation about it, or an example.


Thanks!


Facebook Integration in Android [on hold]

How to post on friend's wall using facebook sdk in andorid?


Is There Any Way to Get Shared Link Count in Certain Period of Time Using Facebook Graph API?

I'm trying to get share count for link shared in Facebook during certain period of time. The links are all links to my website. I'm thinking of using the Facebook Graph API - insights, do daily checking and save the share count.


From graph explorer I get the insights/domain_stories result and it has this:



"values": [
{
"value": 0,
"end_time": "2015-03-21T07:00:00+0000"
},


Reading at the metric description I thought I would get detail like which page in my website that's been shared.


http://ift.tt/1C0LB5O


Is there any way to get that kind of information?


lundi 30 mars 2015

How to make access token alive?

I get my access token from this page and my app is able signup through Facebook.


I want to keep the access token from the user alive forever. However the access_token expires after an hour.


How can I get a non-expiring access_token?


Next million dollar social network idea but need some advice [on hold]

I have been planning an online social network for my niche for about 1 month. I have drawn up all the designs, concepts and coding softwares I need (domain, phpmyadmin, sublime text) HOWEVER:


As I started coding I found things very difficult as I only have a years experience in HTML and literally none in PHP (been following a tutorial). My question is can I build a social network using wordpress. If not should I find a book on how to code it myself, one on PHP or what ?


My website is fairly basic for a social media site. All it requires is : 1) people allowed to post on particular pages and see what others have posted 2) profile system (login system) 3) friend system 4) like a comment system and promote the most liked comment 5) people allowed to vote on particular things and the results posted on a different page


So how should I create this, ONE use wordpress or TWO find a book on PHP and learn from there (how long would that take). Please only positive comments as I don't find negativity usefull :P


Thanks so much in advance and yes you can downvote and laugh about "a million dollars" but this its ridiculous that it has not been thought of before !


What will happen with my app if I not get permission from FB to use "publish permissions"

I have a iOS application with more that 20k users. All current app versions are asking for publish permissions from user, but I never used it.


I'm already working on new version without this permissions, but I wonder what will happen with my app after April 30, 2015 without FB review? I don't have to go thru it if I'll remove publish permission from my app.


User can be still able to log in using facebook?


Mariusz


How to understand Json_decode and covert it to save-able format for database

When I get facebook login token and send it to graph link, it will return a json string, in which I find this type of format:



Luy\u1ec7n


I don't understand how facebook encode it but how it appears on facebook page actually (Vietnamese) is:



Luyện


Then I use:



$array = json_decode($data, true);


It becomes: Luyện


How could I change it to the original word Luyện ? and save it to my database ? and then, is it right way to save name to database then later query from database for other checking purposes ?


Facebook GraphAPI Reduce amount of data with limit

So I'm struggling to find where this is documented (if at all), but I'm getting the following error message when requesting data from the FB GraphAPI.



"Please reduce the amount of data you're asking for, then retry your request"


The call I'm making is:



/v2.3/user1/posts?fields=object_id&limit=100


If I change it to:



/v2.3/user2/posts?fields=object_id&limit=100


It returns 100 items.


Why would it work for one user, and not the other?


Both requests are authenticated via an access token (not belonging to either user) and I get the same error whether running it from my code, or the Facebook Graph API console of developers.facebook.com


Posting on a Facebook group as admin from website

So I own a group on Facebook and I am creating a website which has a Facebook login and share button. I am right now able to post on my Facebook group as myself but the post in not visible as it is not getting posted as the admin. Is there any way to post as admin directly from the website?


How to define Twitter application permissions

With Facebook, you could set a scope parameter to define the permission you'd like a user to grant to the 3rd party application, according to the Spring Social document. For example, you could only give the permission that the 3rd party can just read the user's profile, or you could give the permission that the 3rd party can post onto the user's wall too.


But with Twitter, how to set a scope-like parameter so as to define the permission you'd like a user to give to the 3rd party application? For example, the 3rd party can not only read the user's profile, but also tweet on behalf the user.


How to get post_impression_organic by hour, day or time period?

I am trying to get a statistic of post_impressions_* by a time frame (hour, day, etc) but all I seem to get is "lifetime"



{post_id}/insights/post_impressions_organic/lifetime


If I try anything other than lifetime, like week or day, I get nothing, and even if I could get lifetime, not sure how to break it down by day, or hour.


For example:



- impressions
-- day 3/25: 100
-- day 3/26: 200 total: 300

How to edit "page plug-in" code of facebook graph api

I am a beginner ro facebook graph api.I have a facebook page,http://ift.tt/1abasyp my website I want to place button,so that whenever people click on that button they could like my page.I googled on it and watched many videos on youtube,though didn't get it properly.Finally I copied and pasted some code provided by facebook in my source file.That code is



<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-page" data-href="http://ift.tt/1abasyr" data-hide-cover="true" data-show-facepile="false" data-show-posts="false"></div>


and I got output as shown in the following image.


enter image description here


But I don't want my output like this.So I want to edit this code as,



<div class="fb-page" data-href="http://ift.tt/1abasyr" data-hide-cover="true" data-show-facepile="false" data-show-posts="false"><img src="like us on facebook.png" /></div>


Then it is showing output as follows


enter image description here


Now whenever user clicks on on this button they should like my page.I am unable find an answer to how to achieve this?


Facebook SDK 4 in Android Studio ExceptionInitializeError Login v2.3

First and foremost could someone provide me a sample that just connects and switch to another fragment when logged in that would be great so I'll have working code I can look at to understand. I'm just trying to put a Login button on a test page when the user is connected with facebook then the fragment should change. I tried what's there : http://ift.tt/1GtHi9L but I can't get it working and don't really understand what's going on.. So I'm lost. I'm having a ExceptionInitializeError with the following code. But I doubt it is correct.


My login fragment:



public View onCreateView(
LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.login_frag, container, false);

loginButton = (LoginButton) view.findViewById(R.id.login_button);
loginButton.setFragment(this);

// Callback registration
loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
Toast.makeText(getActivity(),"Success",Toast.LENGTH_SHORT).show();
}

@Override
public void onCancel() {
Toast.makeText(getActivity(),"fail",Toast.LENGTH_SHORT).show();
}

@Override
public void onError(FacebookException exception) {
Toast.makeText(getActivity(),"error",Toast.LENGTH_SHORT).show();
}
});
return view;
}


MainActivity:



protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
monFragmentManager = new MonFragmentManager(getSupportFragmentManager());
monFragmentManager.showFragment(0, false);
FacebookSdk.sdkInitialize(getApplicationContext());
callbackManager = CallbackManager.Factory.create();
LoginButton loginButton = (LoginButton) findViewById(R.id.login_button);
loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
monFragmentManager.showFragment(1,false);
}

@Override
public void onCancel() {
monFragmentManager.showFragment(0,false);
}

@Override
public void onError(FacebookException e) {
monFragmentManager.showFragment(0,false);
}
});
}

% of API Calls in v2.x stuck

We updated the facebook sdk on Android as well as Django Backend(using facebook-sdk) to latest almost a month back. Facebook still complains that 19% of api calls are still made from V1 graph api. Only reason I could think of is from users who have not updated the app. But this figure is stuck on exactly 81% from past 2 weeks. Is there anything that I am missisng. Any help would be appreciated.


Send a message to a Facebook friend from an Android app

I have an app in which I have implemented Facebook login. I am able to retrieve the logged-in user's Facebook friends using the Graph API.


The central problem is that I need to be able to communicate with the logged-in user's friends. This communication can occur in any possible way: wall post, inbox message or chat message.




We will remove the ability to post to a user's friends' walls via the Graph API. Specifically, posts against [user_id]/feed where [user_id] is different from the session user, or stream.publish calls where the target_id user is different from the session user, will fail.




  • Sending chat messages has been deprecated and will soon be impossible. According to the Chat API docs:



On April 30, 2014, we announced the deprecation of the XMPP Chat API as part of the release of Platform API v2.0. The service and API this document covers will no longer be available after April 30, 2015.


Once version 1.0 is deprecated on April 30, 2015, chat.facebook.com and the xmpp_login permission will no longer be available.


We recommend developers who have integrated with the XMPP Chat API deprecate this functionality from their apps before April 30, 2015 to avoid broken experiences.



Basically, I need to send a message to a logged-in user's Facebook friends, without requiring user interaction (This does not mean I will be spamming a user's friends, just that messages will be scheduled in advance using a PendingIntent registered with the AlarmManager). Is this at all possible ?


I apologize for the length of this post, and if you're still with me, I thank you for your patience. I'm not the kind of person that wants to be spoon-fed, but I've reached my wit's end with this problem and the Facebook documentation is not giving me a clear answer. I need a decisive answer or a usable workaround to this problem.


Kindly defer from marking this as duplicate. I have already seen the following questions, and either they are outdated or they do not apply to my problem:


1. Send private message to my friend(s) using my android application .


2. Android facebook send a message .