Android link myself facebook

Android link myself facebook

0 341

I am trying to post a link using Android SDK.

Clicking my post anchor doesn’t open a new browser window, it is using the current tab (the facebook profile/news feed) instead. This results in the user is loosing his/her faecbook browser tab.

This doesn’t seem to me like the intended behavior. Other applications (youtube, NewYorkTimes) do open up a new tab. Maybe it is somehow related, that both my app’s site url and canvas url are set to the same URL that the feed’s link attribute points to.

Checking the anchor’s source, I see that it lacks target=’_blank’ HTML attribute (youtube video posts do have that attribute).
Edit:

Maybe I wasn’t making myself clear… The issue here is not at the stage of posting the feed to the user’s wall. The issue only occurs after a successful post using the feed dialog, when clicking that post (either the post’s attached picture or the link) on the user’s wall. When doing so, you are being redirected to the link’s address (out of facebook) on your current browser tab.
Edit 2:

I am using someone else’s code, it is a Cordova (Phonegap) facebook plugin.

I have copy-pasted one function that may be the relevant function ( located under src\com\facebook\android\Facebook.java), and added 2 log lines that might also be helpful:

/**
* Cordova interface to display a dialog
*/
public PluginResult dialog(final JSONArray args, final String callbackId) throws JSONException, FileNotFoundException, MalformedURLException, IOException {
Log.d(CLASS, “dialog() :” + args.toString());
JSONObject params = args.getJSONObject(0);
PluginResult pluginResult = new PluginResult(PluginResult.Status.NO_RESULT);

final String method = params.has(“method”) ? params.getString(“method”) : “feed”;
JSONObject optionsObject = (JSONObject)params.get(“params”);
final Bundle options = new Bundle();
Iterator keys = optionsObject.keys();
while( keys.hasNext() ){
String key = (String)keys.next();
options.putString(key, optionsObject.getString(key));
//if(optionsObject.get(key) instanceof JSONObject)
}

final FacebookConnect me = this;
Runnable runnable = new Runnable() {
public void run() {
Log.d(“Roei ——->>>>>>>Dialog options:”, options.toString());
Log.d(“Roei ——->>>>>>>Dialog context:”, me.cordova.getContext().toString() );
me.getFacebook().dialog(me.cordova.getContext(), method, options, new RegularDialogListener(me, callbackId));
};
};
pluginResult.setKeepCallback(true);
this.cordova.getActivity().runOnUiThread(runnable);

return pluginResult;
}

NO COMMENTS

Leave a Reply