简体   繁体   中英

Android app : Handling app request posted on Facebook

I went through various Facebook tutorials to handle Facebook integration into Native Android app and have achieved success implementing all flows including Facebook login, fetch user details, Share, Select friends. I am stuck in use case wherein app invite request sent by one user is handled for recipient.

Problem statement: Facebook Send request tutorial explains well on sending app request to friend which works fine for me as i can see success response as below.

fbconnect://success?request=<request ID here>&to%5B0%5D=<userID>

But the next step is to handle the request. As per tutorial, once recipient user opens up the Facebook for Android app and tap on the notification (I am seeing under top left menu -> Apps section), the app is launched using intent containing request data which can be pulled as below.

Uri intentUri = getActivity().getIntent().getData();

Further request ID (one or more) can be fetched as below

String requestIdParam = intentUri.getQueryParameter("request_ids");

In my case, Facebook app launches installed app but intentUri (statement listed above) itself is returned as null. Hence i can't proceed further extracting request details.

Note: i could confirm that posted request contains complete info eg data using below method by passing hardcoded requestID obtained while posting (after logging into app as recepient user).

private void getRequestDetails(String inRequestId) {
        Request request = new Request(Session.getActiveSession(), 
            inRequestId, null, HttpMethod.GET, new Request.Callback() {
                @Override
                public void onCompleted(Response response) {
                Log.d (TAG, response.toString());
                }
            });
        // Execute the request asynchronously.
        Request.executeBatchAsync(request);
    }

An early help/pointers will be higly appreciated. Also, is there a way to query pending app requests through Facebook API rather than invocation through Facebook native app intent invocation.

This is Facebook bug. Just add Mobile Web in App Dashboard and you will get request_ids

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