apprequest dialog from facebook action script 3 sdk - facebook

I am writing an application for Android with Adobe AIR + using facebook action script 3 SDK.
Can I show standart apprequest dialog to user on Android phone?
FB.ui({method: 'apprequests', message: 'You should learn more about this awesome game.', data: 'tracking information for the user'});
How can I call it from facebook action script 3 SDK? Thanx!

take a look of this script, that answer you question
How can I call it from facebook action script 3 SDK?
private function inviteFriends():void
{
var dat:Object = new Object();
dat.message = "Let's invite friends for our Super Extra Max Facebook App, more info go to http://blog.ukasz.com";
dat.title = 'Super Extra Max Facebook App';
// filtering for non app users only
dat.filters = ['app_non_users'];
//You can use these two options for diasplaying friends invitation window 'iframe' 'popup'
Facebook.ui('apprequests', dat, onUICallback, 'popup');
}
and this is the handler
private function onUICallback(result:Object):void{
if(result == null){
trace('User closed the pop up window without inviting any friends');
return
}
var invitedUsers:Array = new Array();
invitedUsers = result.request_ids as Array;
trace('You Have Invited ', invitedUsers.length,' friends');
//Simple if else if you want user to invite certain amount of friends
if(invitedUsers.length > 1){
trace('GREAT, USER IS GENERATING TRAFFIC');
}else{
trace('No Good, User invited only one friend.');
}
}
Thanks to Lucas

Related

Is FB App Review necessary for read only website?

I'm creating a website which show a single Facebook page content in the homepage (events basic informations, photos and the five latest instagram photos). Do I have to submit an App Review? If yes, what permissions do I need?
There is no FB login request in the site and no content is published using it. No FB/Instagram user information is shown.
Thanks,
Alessio
EDIT:
Here is my code. It's the same for every endpoint
function loadFacebookEvents(){
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
fbEvents=JSON.parse(this.responseText).data;
renderFacebookEvents()
//loadFacebookPhotos()
}
};
//events
xhttp.open("GET", "https://graph.facebook.com/thecagelivorno/events?time_filter=upcoming&fields=cover,description,end_time,name,start_time,ticket_uri,place&access_token=<my-access-token>", true);
xhttp.send();
}

how to send facebook message to multiple users using fb.ui

I want to send facebook message to multiple users and after sending message I want those user ids from dialog in response.
I searched that it is not possible only with method send so first I am using apprequests method and from this response I want to pass selected users to facebook send dialog.
Here is the code which I am using.
FB.ui({
method: 'apprequests',
message: "my app request message",
link: 'http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html',
}, function(response) {
if(response && response.hasOwnProperty('to')) {
var user_ids = [];
for(i = 0; i < response.to.length; i++) {
user_ids.push(response.to[i]);
}
console.log(user_ids);
fb_share(user_ids);
}
});
function fb_share(user_ids){
FB.ui({
method: 'send',
to: user_ids, //[862579587127634, 1571716563066056],
link: 'http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html',
});
}
But in this case when Message dialog box appears after inviting friends, it selects only one user not multiple users.
Please help me guys.
Thanks!

get user images twitter | angular.js | firebase

im quite new to angular.js and firebase, so im starting to edit some code from an open source script to expens my knowledge ... i used a chat script with a facebook login.
i decided to go change the facebook login to a twitter login. (firebase lets you use logins pretty easy)
function onLoginButtonClicked() {
auth.login("Twitter");
}
the code also automaticly gets the user image from facebook with
<div id="comments">
<script id="template" type="text/template">
<img class="pic" src="https://graph.facebook.com/{{userid}}/picture">
<span><b>{{name}}</b><br/>{{body}}</span>
</script>
But now i changed it to an twitter app i wonder how i can get the twitter user icons instead?
--edit--
whats wrong with the question?
If you check out the user info returned from the login process, you'll see that it contains a an object called thirdPartyUserData. It contains all of the information provided by twitter during login; this is their purview and could change when their API or policies change in the future, but has (for as long as I've been familiar with the Twitter API) contained URLs for user's avatars:
var ref = new Firebase(URL);
var auth = new FirebaseSimpleLogin(ref, function(err, user) {
if( err ) console.error(err);
console.log('avatar is ', user && user.thirdPartyData.profile_image_url);
});
$('button').click(function() {
console.log('clicked it');
auth.login('twitter');
});
(Side note: the login provider is twitter vs Twitter)
There is another way to get the Twitter avatar which works better since getting it from the login user object is only for the logged in user and so would require that the URLs be saved which would then be a problem if the user ever changed their twitter avatar since the URL would then be missing. After some searching around I found that the twitter avatar (or facebook) avatar can be reached from the firebase user id as follows:
var info = userId.split(':');
var provider = info[0];
var id = info[1];
if ( provider === 'facebook' ) {
return 'https://graph.facebook.com/' + id + '/picture?type=square';
} else if ( provider === 'twitter' ) {
return 'http://twitter.com/api/users/profile_image/' + id + '?size=normal';
}

Can I make an app available only to people that like a facebook page? [duplicate]

This question already has answers here:
How to check if a user likes my Facebook Page or URL using Facebook's API
(5 answers)
Closed 9 years ago.
I have made a facebook App and associated with a page. I only want people that like the page to be able to use the app. Is this possible?
When somebody tries to load your app, they will need to be authorised.
Once authorised, you can query the user's graph to see what they like:
(I've assumed you've authorised using the php sdk, and will have the $facebook object, however the principle is the same for other techniques)
$fanPageId = "xxxxxxxxx";
$appId = "xxxxxxxxxx";
$fanPageLiked = false;
$appLiked = false;
$likes = $facebook->api('me/likes');
foreach ($likes['data'] as $ilike) {
if ($ilike['id'] == $fanPageId) {$fanPageLiked = true;}
if ($ilike['id'] == $appId) {$appLiked = true; }
}
if ($fanPageLiked)
{
.... run your game.
}
else
{
.... redirect to fan page.
}

How to invite friends in Facebook app with AS3

i'm making a Facebook application (Flash) where i must invite friends. Every place i reach i found this piece of code but isn't working for me because result.request_ids is null. I need to know how many friends the user invited!!! Please help!!!
Code:
private function inviteFriends():void{
var dat:Object = new Object();
dat.message = "Let's invite friends for our Super Extra Max Facebook App, more info go to http://blog.ukasz.com";
dat.title = 'Super Extra Max Facebook App';
// filtering for non app users only
dat.filters = ['app_non_users'];
//You can use these two options for diasplaying friends invitation window 'iframe' 'popup'
Facebook.ui('apprequests', dat, onUICallback, 'popup');
}
private function onUICallback(result:Object):void{
if(result == null){
trace('User closed the pop up window without inviting any friends');
return
}
var invitedUsers:Array = new Array();
invitedUsers = result.request_ids as Array;
trace('You Have Invited ', invitedUsers.length,' friends');
//Simple if else if you want user to invite certain amount of friends
if(invitedUsers.length > 1){
trace('GREAT, USER IS GENERATING TRAFFIC');
}else{
trace('No Good, User invited only one friend.');
}
}
function invite(evt:MouseEvent):void
{
var obj:Object =
{
message: "",
title: ""
};
Facebook.ui("apprequests", obj, cbi, "iframe");
}
function cbi(res):void
{
field_txt.appendText(res.request_ids);
}