I am using action_send for Facebook sharing here insert image only but not added text what is the reason? - facebook

Here is Facebook sharing code:
String text = "Offer Ends:" + offerending + "\n Offer Type:"
+ offertype + "\n Address:" + offaddress + "\n"
+ webbsuitee;
String completePath = Environment.getExternalStorageDirectory()
+ "/" + "temporary_file.jpg";
File file = new File(completePath);
// Uri imageUri = Uri.fromFile(file);
Uri imageUri = Uri.fromFile(file);
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("image/*");
shareIntent.putExtra(Intent.EXTRA_TEXT, "Hello");
shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(shareIntent, "send"));

It is closed by Facebook API. You need to use the Facebook SDK for Android to do so!
check this: https://developers.facebook.com/bugs/332619626816423

Related

how to request additional scopes from facebook api

I redirect users to the URL
display = '&display=page',
state = '&state=facebook_auth_' + csrfToken,
scope = '&scope=' + this.scopes,
redirect = '&redirect_uri=' + redirectUrl,
facebookURL = 'https://graph.facebook.com/oauth/authorize?client_id=' + this.clientId + redirect + scope + display + state;
For some reason, when I try to request new permissions by redirecting users to the URL above, Facebook does not show a prompt asking the user for access to the new permissions. What am I doing wrong

facebook sharing on servlet, jsp; getting auth code;

public FacebookConnector() {
try {
FacebookClient.AccessToken token = getFacebookUserToken("???", "http://localhost:8083/CrunchifyJSPServletExample/");
String accessToken = token.getAccessToken();
Date expires = token.getExpires();
fbClient = new DefaultFacebookClient(this.accessToken, Version.LATEST);
myuser = fbClient.fetchObject("me", User.class);
mypage = fbClient.fetchObject(pageID, Page.class);
counter = 0;
} catch (Exception ex) { //So that you can see what went wrong
ex.printStackTrace(System.err); //in case you did anything incorrectly
}
}
public void makeTestPost() {
FacebookType publishMessageResponse = fbClient.publish("me/feed", FacebookType.class, Parameter.with("message", "Test from Graph API"));
System.out.println("Published message ID: " + publishMessageResponse.getId());
}
private FacebookClient.AccessToken getFacebookUserToken(String code, String redirectUrl) throws IOException {
String appId = "My App Id";
String secretKey = "My Secret Key";
WebRequestor wr = new DefaultWebRequestor();
WebRequestor.Response accessTokenResponse = wr.executeGet(
"https://graph.facebook.com/oauth/access_token?client_id=" + appId + "&redirect_uri=" + redirectUrl
+ "&client_secret=" + secretKey + "&code=" + code);
return DefaultFacebookClient.AccessToken.fromQueryString(accessTokenResponse.getBody());
}
I am working on enabling facebook sharing for my application that is built on JSP and servlet.
I am using above code.
I need your inputs on 2 things:
1) If my approach is correct.
2) How to get auth code? So that can help me in getting authentication token.
Help of any sort is appreciated. Thanks. AY
For facebook authentication you can do like that:-
Click
It will generate code then use this code to send request to graph.facebook as you written correctly in your code then it will generate accesscode and use accesscode as per your requirement

how to open a popup including external site (addon SDK)?

I am trying just to open a new popup HTML page (from )
window.open ('http://www.google.fr', 'win', 'height=240, width=640, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no');
Looks like windows does not have options to specify width, height and other options.
https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/windows
You would have to use Low-Level SDK API called 'window/utils' and its openDialog() function (instead of open()), which provides more features to set.
require('sdk/window/utils').openDialog({
url: 'http://www.google.fr',
name: 'The window I dreamt of',
features: 'height = 240,' +
'width = 640,' +
'toolbar = no,' +
'menubar = no,' +
'scrollbars = no,' +
'resizable = no,' +
'location = no,' +
'directories = no,' +
'status = no'
});
This API is described here:
https://developer.mozilla.org/en-US/Add-ons/SDK/Low-Level_APIs/window_utils
And here you can find full list of supported features for openDialog():
https://developer.mozilla.org/pl/docs/Web/API/Window/open

Getting null value while displaying contacts in iphone phonegap application

I am working on Phonegap application and trying to get the contacts of the device.
What I have done from this reference is as follows :
function onDeviceReady() {
var options = new ContactFindOptions();
options.filter=""; // empty search string returns all contacts
options.multiple=true; // return multiple results
filter = ["displayName"];
navigator.contacts.find(filter, onSuccess, onError, options);
}
// contacts Methods
function onSuccess(contacts) {
for (var i=0; i<contacts.length; i++) {
for (var j=0; j<contacts[i].addresses.length; j++) {
alert("Pref: " + contacts[i].addresses[j].pref + "\n" +
"Type: " + contacts[i].addresses[j].type + "\n" +
"Formatted: " + contacts[i].addresses[j].formatted + "\n" +
"Street Address: " + contacts[i].addresses[j].streetAddress + "\n" +
"Locality: " + contacts[i].addresses[j].locality + "\n" +
"Region: " + contacts[i].addresses[j].region + "\n" +
"Postal Code: " + contacts[i].addresses[j].postalCode + "\n" +
"Country: " + contacts[i].addresses[j].country);
}
}
};
// onError: Failed to get the contacts
function onError(contactError){
alert('onError!');
}
In console while printing the contacts I am getting this error-
[INFO] Error in success callback: Contacts1 = TypeError: 'null' is not an object
There are contacts in my simulator and contact information is not null still I am getting null. Not sure about the reason.
Please help me.
EDIT : same thing is happening when I am playing audio files ..
Any one have idea why this is happening ??

multi-friend selector does not work in https (secure browsing enabled)

We are using facebook iframe app in https mode, from our app we need to send an invitation to multiple friends using multi-friend selector.
But when we click on Select Friends button, it is showing blank popup. It works fine for http (non secure browsing).
"<fb:serverfbml><script type=\"text/fbml\">" +
"<fb:fbml>" +
"<fb:request-form action=\"" + (HttpContext.Current.Request.IsSecureConnection ? ConfigurationManager.AppSettings["Callback"].Replace("http://", "https://") : ConfigurationManager.AppSettings["Callback"]) + "pagename.aspx?dbskip=true&fb_sig_user=" + fbuserid + "\"" +
"method=\"POST\"" +
"invite=\"true\"" +
"type=\"My App \"" +
"content=\"" + "my content" +
"<fb:req-choice url='" + "my choice"+ "'" +
"label='" + " my text "+ "'/>" +
"\">" +
"<fb:multi-friend-selector bypass=\"cancel\" email_invite=\"false\" max=\"35\" cols=\"5\" actiontext=\"Select friends to send invitation\" rows=\"3\"/>" +
"</fb:request-form></fb:fbml></script></fb:serverfbml>";
Thank in advance......
Maybe you shouldn't use legacy FBML now. It is deprecated.