Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Post on facebook wall using postdata

Author
Message
TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 28th May 2014 20:11
Hello!

I tried this piece of code posted by Mr Bamber:


But the image, the title and the summary don't appear. Any idea why?
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 28th May 2014 21:22 Edited at: 28th May 2014 21:23
Facebook has changed this and will likely continue to phase it out or change it further. It's hard to find info on it, but the current method is this:


To use this you will need to have an app listing for your game on Facebook so that you can get the app_id. The picture needs to be hosted on a website and requires a URL.
I use the above method as an alternative when the user doesn't have the Facebook app installed.

More info here:
http://stackoverflow.com/questions/20956229/has-facebook-sharer-php-changed-to-no-longer-accept-detailed-parameters
They're doing this to crack down on sites and apps that make use of this method without the app ID. They want to force you to use the app ID so they can track you

TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 29th May 2014 00:23
Thanks a million times. Their website is becoming a real chore both for users and devs. I can't imagine anyone bored enough to log in, accept the app and enter the stupid captcha... I worked on it half a day and I'm already fed up with facebook. Besides I'm sure they are going to change their sdk and postdata process again in less than a year... *sigh*

Tomorrow I'll see if I can work something similar with twitter.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 29th May 2014 00:30
I've never seen a captcha when approving an app. That's not how mine work unless they changed something in the past week or so. I certainly hope not! Can't imagine what the point of captcha is if you're providing existing login info. Major annoyance.
Yeah, FB is a chore.

Twitter isn't too bad, they do change things without notice too though. Just not nearly as much
https://dev.twitter.com/docs/intents

Facebook also needs to work on its Android app so that when you click a Facebook.com link it opens in the app.

TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 29th May 2014 02:04 Edited at: 29th May 2014 02:08
I wrote my facebook code in this fashion:



It worked once. I had to enter my full login, then I had to authorize the app, and to finish I had a d*mn captcha to fill in. But it worked.

Now I launch the app a second time, with the exact same code and it doesn't work. As soon as I trigger the facebook code, I see the facebook app opening in the background, then the screen goes black and the message "please wait..." is written on white in the middle of the screen. I waited for half an hour but nothing happened. When I press "back", it goes back to my app and it behaves as if the login was successful (the facebook button disappears when the getfacebookloggedin() returns 1).

I need to hit the pillow and clear my head. Maybe I missed something.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 29th May 2014 02:27
If you had to enter your email address and password for Facebook login AND you have the Facebook app on your device then something is wrong. It is most likely your setup with Facebook.com app page.

The code I use in AppGameKit isn't far off from yours, but you have to wait until GetFacebookLoggedIn() returns a 1 before moving on to posting to wall.



Here's some screenshots of how it should be set up on FB





A very important part is to make sure that you have your key hash correct.
There is one key hash that you'll have when you haven't used a keystore to sign the app.
And there is another for your actual production keystore.
Getting the keystore can be a pain, but it works.
Also sometimes FB needs a little time to propagate the info for your app to servers.

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 29th May 2014 02:32
Oh! And it is important to note that
"http://mywebsite.php", "http://mywebsite.php/image.png"
is probably a bad idea!
That's not a website.
Furthermore Facebook won't share if the website is not set up in the website sections. I think... I can't fully recall, but I remember it saying something about me not owning the website when I tried to use a different one other than what I had set up on the app page.

TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 29th May 2014 02:54 Edited at: 29th May 2014 03:10
The hash was ok I think. I still don't understand how eclipse reports the same hash build after build. I thought these were the print of the file.

Anyway, it worked once even with no website listed in facebook developer console. I dont' understand why it doesn't work anymore. I tried to fill a couple entries that you have and that I didn't have. It still doesn't work.

I'm using Gingerbread by the way (android 2.3). That might be relevant.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 29th May 2014 03:12
The hash is related to the keystore only. When you run your app directly from Eclipse it signs the app with the debug keystore. Always the same one. When you Export the app it signs with whatever keystore you chose. I only use one keystore for signing all of my apps, so my hash is actually the same for all of my Facebook apps.

I just tried Shape Time! on my old HTC running 2.3 and it works OK. I also had to install FB app because I never had it on the phone I guess. All I can think of is that it is taking FB longer than normal to propagate your app's info to the servers.

If the has was wrong then you'd usually get a red error message saying that it was wrong or the app wasn't allowed or something to that effect.

To do some extra testing you might want to add a FacebookLogout call to your code before you attempt to do the Facebook login. You should not get a window asking for FB credentials if you have FB app installed. Just a dialogue asking for approval. No captcha either. If you are then the app info isn't set up right on FB or they haven't updated all the servers with it yet.

If you don't have the FB app installed then you might get the credentials login prompt too, but after login the AppGameKit app should hold the session data for a while.

Also when testing you should go to your Facebook settings on Facebook.com and go to the app section. There you will see your game's approval. You need to remove it to re-test the login procedure. Otherwise FB says you already approved and just goes on.

TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 29th May 2014 04:10 Edited at: 29th May 2014 04:13
Okay, thanks to you I somehow sorted the issue.

I added a website with a valid entry on the facebook dev console (http://myaccount.myfreehost.com/ worked like a charm). Then and only then I could add this url to the app domains. Before adding the website, the console said my app domain was not valid.

Then I unsubscribed from my app in my facebook account and relaunched the app.

And it seems to be working. When I manage to read their captcha, which is about 1 out of 5 times, it works. The message does end up on my wall. Bottom line is: I think the app domain is required.

But I think I'm going to stick with the openbrowser method. At some point the facebook overlay couldn't reset the captcha so it took upon itself to load my whole facebook home page over my running app, which can barely hold 24 fps on its own. Worst. Idea. Ever.

My hatred for facebook went over 9000 a few minutes ago but thanks to you it went back to its former 8999.

Thanks again, Naphier, your help is invaluable.

3 am. Need sleep.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 29th May 2014 18:29
I've never seen a captcha for Facebook login via an app.
I just uninstalled the FB app on my phone to try to see this captcha you keep mentioning and even then it is not there for me.
I'm very confused by this.
If you have the FB app installed you should not see a captcha, you should not even see a dialogue to enter credentials. You should only see a window that says your app needs approval with an OK or cancel button and explanation of permissions.
I've also never seen the in-app browser load a Facebook feed. I wasn't even aware it could do that.
Are you using the Facebook SDK that came with AppGameKit? What version of AppGameKit?

TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 29th May 2014 19:49 Edited at: 29th May 2014 19:52
I'm using AppGameKit 1.821 with the the facebook SDK that came with AGK.

Maybe the captcha is region specific. Or maybe I get it because I didn't answer the intrusive questions facebook asks whenever I log in. Go figure.

When my app logs in facebook, it goes to the background and the facebook app starts. When logged in (a couple seconds later) it switches back to my app and then the captcha appears in an overlay window (I can see my app running behind it). I think it is triggered by the postonmywall() function. If (When) some error occurs, it shows the error for 5 seconds and loads facebook in the overlay window. And my phone stutters to death.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 29th May 2014 19:59
That all sounds very odd to me. Maybe it is region specific.

Login to post a reply

Server time is: 2024-04-28 11:15:52
Your offset time is: 2024-04-28 11:15:52