开发者

send an invitation to facebook friends to join my website

I have build an android application in which I've integrated faceboook using the fac开发者_高级运维ebook-sdk package.I've also succeded to retrieve in my application the name of all my facebook friends, their names and their id's.Further I want to send from my application an invitation to all facebook friends to join a website.Can u point me in the right direction cause I haven't found anything on the internet.Thank you


Try using the code below, if you follow the tutorials i gave you in your other question it will work no probs!

protected void postOfferToWall(String userID){
    try {
        if (isSession()) {
            String response = mFacebook.request((userID == null) ? "me" : userID);

            Bundle params = new Bundle();
            params.putString("message", "message goes here");
            params.putString("link", "http://mysite.com");    
            params.putString("caption", "Click the link");
            params.putString("description", "description of link"); 
            params.putString("name", "name of link");
            params.putString("picture", "http://url.to.my.picture/pic.jpg");

            response = mFacebook.request(((userID == null) ? "me" : userID) + "/feed", params, "POST");       

            Log.d("Tests",response);
            if (response == null || response.equals("") || 
                    response.equals("false")) {
                Log.v("Error", "Blank response");
            }
        } else {
            // no logged in, so relogin
            Log.d(TAG, "sessionNOTValid, relogin");
            mFacebook.authorize(this, PERMS, new LoginDialogListener());
        }
    }catch(Exception e){
        e.printStackTrace();
    }
}


For a quick reference using the Graph API to post to your friends wall, see Graph API - Facebook Developers. There is a subsection called Publishing, where they use curl to post to a friends wall. Of course you need to get the access tokens and permissions to do such activities but it is all explained here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜