Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share open graph android #747

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

bixev
Copy link

@bixev bixev commented Oct 17, 2014

try this on both iOS and Android :

facebookConnectPlugin.showDialog({
  method: 'share_open_graph',
action_type: 'og:share',
action_properties: JSON.stringify({
    object: "http://og.mateprofiler.com/en/app.html"
  })
});

on iOS you have the thumbnail, currently on Android it is processed like share.
Commit allow to use share_open_graph, but the response remains something with keys like com.facebook.platform.extra.POST_ID instead of only post_id on ios or javascript sdk

aogilvie and others added 3 commits September 29, 2014 13:12
Bumped version to attempt fix for PhoneGap Build error `A plugin already exists with that plugin id and version`
@aogilvie
Copy link
Collaborator

@bixev Please add

import com.facebook.model.OpenGraphAction;

OpenGraphAction ogAction = GraphObject.Factory.create(OpenGraphAction.class);
ogAction.setType(paramBundle.getString("action_type"));
String previewPropertyName = null;
try{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space try {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@aogilvie
Copy link
Collaborator

@bixev How setup Facebook site? The documentation is terrible...

I tried to create a story but I got the error Failed to generate preview for user.

screen shot 2014-10-28 at 5 09 44 pm

Also..

You don't create a OpenGraphObject it is not needed?

@bixev
Copy link
Author

bixev commented Oct 28, 2014

you dont really need to create object first if you use some standard action type (like "og:share") and an existing object (like a website page)
You can customize with your own objects and actions by using self-hosted objects (website page with facebook meta-data) or facebook api to create facebook-hosted ones : https://developers.facebook.com/docs/opengraph/using-objects

@aogilvie
Copy link
Collaborator

Looked into this error more today:

I/sf_frame_dur(  190): [io.cordova.hellocordova/io.cordova.hellocordova.HelloCordova,9093,5,0,2,0,0,0]
W/fb4a(:<default>):BlueServiceQueue( 1328): Exception during service
W/fb4a(:<default>):BlueServiceQueue( 1328): com.facebook.http.protocol.ApiException: [code] 100 [message]: Unsupported post request. [extra]: 
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.http.protocol.ApiResponseChecker.b(ApiResponseChecker.java:103)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.http.protocol.ApiResponseChecker.a(ApiResponseChecker.java:136)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.http.protocol.ApiResponseChecker.a(ApiResponseChecker.java:233)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.http.protocol.ApiResponseChecker.a(ApiResponseChecker.java:184)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.http.protocol.JsonResponseHandler.a(JsonResponseHandler.java:34)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.http.protocol.ApiResponseHandler.b(ApiResponseHandler.java:78)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.http.protocol.ApiResponseHandler.a(ApiResponseHandler.java:53)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.http.protocol.ApiResponseHandler.handleResponse(ApiResponseHandler.java:28)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.http.common.FbHttpRequestProcessor.a(FbHttpRequestProcessor.java:468)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.http.common.FbHttpRequestProcessor.a(FbHttpRequestProcessor.java:179)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.http.common.FbHttpRequestProcessor.b(FbHttpRequestProcessor.java:132)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.http.common.FbHttpRequestProcessor.a(FbHttpRequestProcessor.java:275)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.http.protocol.SingleMethodRunnerImpl.a(SingleMethodRunnerImpl.java:488)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.http.protocol.SingleMethodRunnerImpl.a(SingleMethodRunnerImpl.java:237)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.http.protocol.AbstractSingleMethodRunner.a(AbstractSingleMethodRunner.java:20)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.platform.common.server.SimplePlatformOperation.a(SimplePlatformOperation.java:40)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.platform.common.server.PlatformOperationHandler.a(PlatformOperationHandler.java:60)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.fbservice.service.BlueServiceQueue.e(BlueServiceQueue.java:360)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.fbservice.service.BlueServiceQueue.d(BlueServiceQueue.java:58)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.fbservice.service.BlueServiceQueue$3.run(BlueServiceQueue.java:280)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at com.facebook.common.executors.ListenableScheduledFutureImpl.run(ListenableScheduledFutureImpl.java:58)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at android.os.Handler.handleCallback(Handler.java:738)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at android.os.Handler.dispatchMessage(Handler.java:95)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at android.os.Looper.loop(Looper.java:135)
W/fb4a(:<default>):BlueServiceQueue( 1328):     at android.os.HandlerThread.run(HandlerThread.java:61)
I/am_finish_activity(22196): [0,410465451,24,com.facebook.katana/com.facebook.composer.activity.ComposerActivity,app-request]
I/am_pause_activity(22196): [0,410465451,com.facebook.katana/com.facebook.composer.activity.ComposerActivity]
I/am_on_paused_called( 1328): [0,com.facebook.composer.activity.ComposerActivity]
I/am_resume_activity(22196): [0,686218089,24,com.facebook.katana/com.facebook.platform.common.activity.PlatformWrapperActivity]
I/am_finish_activity(22196): [0,686218089,24,com.facebook.katana/com.facebook.platform.common.activity.PlatformWrapperActivity,app-request]
I/am_pause_activity(22196): [0,686218089,com.facebook.katana/com.facebook.platform.common.activity.PlatformWrapperActivity]
I/am_resume_activity(22196): [0,568439347,24,com.facebook.katana/com.facebook.platform.common.activity.PlatformActivity]
I/am_finish_activity(22196): [0,568439347,24,com.facebook.katana/com.facebook.platform.common.activity.PlatformActivity,app-request]
I/am_pause_activity(22196): [0,568439347,com.facebook.katana/com.facebook.platform.common.activity.PlatformActivity]
I/am_resume_activity(22196): [0,847436778,24,io.cordova.hellocordova/.HelloCordova]
D/CordovaActivity(18314): Incoming Result
D/CordovaActivity(18314): Request code = 64207
D/CordovaActivity(18314): We have a callback to send this result to
D/ConnectPlugin(18314): activity result in plugin
E/Activity(18314): Error: com.facebook.FacebookException: Failed to generate preview for user.

Key is this line:

com.facebook.http.protocol.ApiException: [code] 100 [message]: Unsupported post request. but I find nothing on the interwebs. 🌝

I'm using your code exactly, Facebook developer site is empty... I added nothing.

Iterator<?> iter = ogActionProperties.keys();
while (iter.hasNext()) {
String key = (String) iter.next();
if (previewPropertyName==null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spaces if (previewPropertyName == null) {

@m967800
Copy link

m967800 commented Nov 9, 2014

The open graph share dialog works when the native Facebook app is installed, but fails(still shows up as a share) when using web login. Any suggestions?

@dustinblanchard
Copy link

Would this work cross-platform with the addition of the fix in #667?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants