简体   繁体   中英

Cannot share a photo to facebook using facebook android API

I am trying to share a photo to facebook from my android app. I am following below guides to do it.

Getting Started Android SDK

Sharing on Android

Following is the code I use to share.

if (ShareDialog.canShow(SharePhotoContent.class)) {
    SharePhoto photo = new SharePhoto.Builder().setBitmap(bitap).build();
        SharePhotoContent content = new SharePhotoContent.Builder().addPhoto(photo).build();
        shareDialog.show(MyActivity.this, content);
}

I have created a facebook app in facebook developer console, added my debug and release key hashes to facebook application, added the facebook application ID to the android app manifest as specified in the guide and have done everything as specified in the guide.

But, when I share the photo, facebook share dialog appears for couple of seconds and disappears. Following is logged in Logcat.

04-11 12:51:42.692     443-9537/system_process W/ActivityManager﹕ Scheduling restart of crashed service com.facebook.orca/com.facebook.push.mqtt.service.MqttPushService in 1000ms
04-11 12:51:42.895  22617-22824/com.facebook.katana W/fb4a(:<default>):BlueServiceQueue﹕ Exception during service
    com.facebook.http.protocol.ApiException: [code] 100 [message]: Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api [extra]:
            at com.facebook.http.protocol.ApiResponseChecker.b(ApiResponseChecker.java:104)
            at com.facebook.http.protocol.ApiResponseChecker.a(ApiResponseChecker.java:137)
            at com.facebook.http.protocol.ApiResponseChecker.a(ApiResponseChecker.java:234)
            at com.facebook.http.protocol.ApiResponseChecker.a(ApiResponseChecker.java:185)
            at com.facebook.http.protocol.JsonResponseHandler.a(JsonResponseHandler.java:34)
            at com.facebook.http.protocol.ApiResponseHandler.b(ApiResponseHandler.java:91)
            at com.facebook.http.protocol.ApiResponseHandler.a(ApiResponseHandler.java:54)
            at com.facebook.http.protocol.ApiResponseHandler.handleResponse(ApiResponseHandler.java:29)
            at com.facebook.http.common.FbHttpRequestProcessor.a(FbHttpRequestProcessor.java:768)
            at com.facebook.http.common.FbHttpRequestProcessor.a(FbHttpRequestProcessor.java:245)
            at com.facebook.http.common.FbHttpRequestProcessor.a(FbHttpRequestProcessor.java:177)
            at com.facebook.http.common.FbHttpRequestProcessor.a(FbHttpRequestProcessor.java:73)
            at com.facebook.http.common.FbHttpRequestProcessor$Dispatcher.run(FbHttpRequestProcessor.java:956)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at com.facebook.common.executors.ConstrainedListeningExecutorService$Worker.run(ConstrainedListeningExecutorService.java:288)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at com.facebook.common.executors.NamedThreadFactory$1.run(NamedThreadFactory.java:38)
            at java.lang.Thread.run(Thread.java:841)

How can I find the reason why this happens? Is there a way to get more information on why the get request is unsupported?

From the log error, I guess there's something wrong with the permission. Can you make sure you use the login process correctly? Or you can paste your full code.

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