I have created application in Facebook. By using Facebook Javascript SDk, I posted message from android phonegap application to facebook wall.But I want to display permission dialog before message post on the wall
(ie) While I am clicking “Allow” button in the permission dialog message should post on the wall,while i am clicking “Don’t Allow” button, message should not post on the wall.
My code is:
<body>
<div id='fb-root'></div>
<script src='all.js'></script>
<input type="text" value="User ID" name="user_ids" />
<p><a onclick='postToFeed(); return false;'>Post to Feed</a></p>
<p id='msg'></p>
<script>
FB.init({appId: "xxxxxxxx", status: true, cookie: true});
function postToFeed()
{
var user_ids = document.getElementsByName("user_ids")[0].value;
alert(user_ids);
FB.api('/me/feed', 'post', { message: user_ids}, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
}
</script>
</body>
the above code is hosted on server. In phonegap(index.html) i called the url using window.open method, It will display textbox and button. while i am clicking the button,(get value from textbox)the message should post on the wall
how to set permission dialog for this coding or how to pass {perms:’publish_stream’} in FB.api(‘/me/feed’)
Please give me some suggestion /ideas
Thanks in advance.
I don’t know if I’m getting your question right, but I would suggest this:
First ask permission and in the next step show the send button or send a post automatically – what ever you want. Not both at the same time (I just don’t get the concept). Here is some code that might help you a little: