7

Lately we've been working on a 3D XNA-powered game for Windows Phone 7. We wanted to integrate an achievements system and be able to post achievements to Facebook. My question is: have someone done already a similar thing? Are there any good tutorials/resources on how to do so?

To my understanding, in order to login on Facebook, one can fire a WebBrowserTask on XNA, which will open a url using internet explorer app but meanwhile the xna game will be deactivated and reactivated when user press back button. The OAuth token could be transmitted back to the app using our own server. But would it be the only way to do so?

EDIT: I've successfully solved Facebook OAuth without a browser problem, see my blogpost: http://roman.ae-labs.org/?p=116

1
  • 1
    @Kel The blog link you provided doesn't exist. Could you update with the new link, so that it helps others in the future.
    – nkchandra
    Dec 31, 2012 at 9:06

2 Answers 2

5
+100

You couldn't do this directly with the WebBrowserTask. You'd been to embed a web browser in your app, which, with XNA, you can't do.

This was asked on the facebook forums.

As a workaround you could try using the WebBrowserTask indirectly:

  1. Have you app open a web page (with the WebBrowserTask) on your site and pass it the ANID from the device.
  2. In that web page, present the ability to do the OAUTH with Facebook and have your web page manage the association between ANID and OAUTH login.
  3. When you wish to post an achievement. Have the app send the achievement and ANID to your website and then have that relay the update to Facebook.

Your app would need to check with your website to see if the oauth had been done or not as the site couldn't send the response back after step 2 (without a push notification).

Untested, but I don't see why the above wouldn't work.

2
  • Okay, thanks. I will have to try it I guess. I'll post here my findings
    – Kel
    Nov 26, 2010 at 17:23
  • 1
    Unfortunately this is the only way I could see this working due to the fact that in-app single sign on in Android and iOS involves interacting with the native Facebook application. Dec 3, 2010 at 13:15
-2

Check out the Facebook C# SDK. In the current source we have a sample WP7 app that shows you how to do Facebook login. That should be everything you need to get started. http://facebooksdk.codeplex.com

3
  • The sample isn't helpful, it's a sample for Silverlight on WP7. I'm looking for an XNA on WP7 solution (and unfortunately there is no way to host SL or webbrowser in xna app on WP7). But the core of the framework seems nice, I'll check it out.
    – Kel
    Nov 26, 2010 at 17:27
  • There are 3 samples. WP7, Silverlight in browser, silverlight out of browser. Nov 29, 2010 at 15:25
  • I haven't done any XNA dev, but if you can't use a browser frame you aren't going to be able to have the user log into facebook. Facebook OAuth requires a browser. You are going to have to build something outside of your app, get the user's access token and request offline access, that way you can save their access token and reuse it. You could use the C# SDK inside your game or do the approach discussed above and call your own web service then cal facebook from your server. Dec 28, 2010 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.