简体   繁体   中英

Android Facebook API not sending APP Requests

I am using the Android Hackbook app. I have slightly modified the code to send a app request to aa Custom Friend. Here is the code.

Bundle params = new Bundle();
    params.putString("title", "invite friends");
    params.putString("message", getString(R.string.request_message));
    params.putString("to", userId);
    Utility.mFacebook.dialog(Hackbook.this, "apprequests", params, new AppRequestsListener());

This brings up a dialog to send a app request to the friend who user id i selected. The AppRequestsListener code gets executed and it shows me a toast that the request was successful. How the user never receives the request. What am i doing wrong. Is there some permission that i need to grant to the application first. Really stuck, any help would be good

Kind Regards,

Try this:

        Facebook facebook = new Facebook(YOUR_APP_ID);
        Bundle params = new Bundle();
        params.putString("to", userId);
        params.putString("message", "getString(R.string.request_message)");
        facebook.dialog(((Activity) ctx).getParent(), "apprequests",
                params, new DialogListener() {

                    public void onComplete(Bundle values) {
                        // TODO Auto-generated method stub
                        Toast.makeText(ctx, "<<Complete>>",
                                Toast.LENGTH_SHORT).show();
                    }

                    public void onFacebookError(FacebookError e) {
                        // TODO Auto-generated method stub
                    }

                    public void onError(DialogError e) {
                        // TODO Auto-generated method stub
                    }

                    public void onCancel() {
                        // TODO Auto-generated method stub
                    }

        });

This works for me. User receive request as expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM