antonkrasov / AndroidSocialNetworks

Library for easy work with Facebook, Twitter, LinkedIn and Google on Android
1.03k stars 260 forks source link

Facebook share not working #24

Closed invizorys closed 9 years ago

invizorys commented 10 years ago

I press "post to facebook", application hangs on executing request and nothing else happens screenshot

danielwilson1702 commented 10 years ago

The same thing happens to me, same thing with posting photos to FB, this is all I've tried though :(

gorbin commented 10 years ago

Yes there is a problem with old facebook sdk, I solved it and make pull requests tommorow or at weekands.

If you need it right now - you can try my extension for this lib https://github.com/gorbin/ASNE

as I said all changes I'll pull as soon as posible

gorbin commented 10 years ago

I made pull request, and here some info:

firstly, to post and corect work with facebook you need to setup fb app correctly:

for example, you can add your app to check share posibilities: 1) create your app in facebook 2) add android platform 3) enable your app in review-status 4) in \api_demos\src\main\res\values\congig.xml setup your appId

p.s. this error may corrupt becouse FB update their api and stay old apps work as they work, and new work by new rules It would be great if @antonkrasov update fb app(just create new one) to resolve all errors which may occur old/new api. now api-demo use old fbapp

gorbin commented 10 years ago

Finally I found what happens. Facebook policy changed when they updates to Login Api, now to get publish permission facebook App should be reviewed to get publish action permissions, but they didn't review small "test" apps, for them they give another opportunity - roles in facebook app So, all users who are not testers/developers of facebook app didn't see and can't confirm publish permission(its need to make make post, photo, links) - but administrator can add anybody as tester, he ned just add id, then requester should confirm in his facebook dev account, that he is tester - after it he got all necessary permissions

look to red alert box screenshot 10

Roles in app screenshot 11

Confirm request screenshot 12

Or we got alternative - dialog, which dont need publish permission screenshot 14

I add it as soon as possible, I can add dialogs only to G+ and FB

mclovin-2k commented 10 years ago

@gorbin The following code snip shows how to post to twitter app's dialog.

Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_TEXT, "some message"); intent.setType("text/plain"); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); intent.setComponent(new ComponentName("com.twitter.android", "com.twitter.android.composer.ComposerActivity")); try { startActivityForResult(intent, REQUEST_CODE_POST); } catch (ActivityNotFoundException e) { //Can't found Twitter App }

gorbin commented 10 years ago

@dna1982 Tnx, I'll try it, but it works only if user got twitter app, else need to create custom dialog - dont want to create my custom dialog(security etc.)

my custom fork with 2 russian social networks(sorry for russian) - https://github.com/gorbin/ASNE check dialogs here...