Post WP7 Game Achievements from XNA to Facebook

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


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:

  • Have you app open a web page (with the WebBrowserTask) on your site and pass it the ANID from the device.
  • 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.
  • 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.


    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

    链接地址: http://www.djcxy.com/p/3894.html

    上一篇: 如何编写不泄漏内存的Silverlight控件

    下一篇: 从XNA到Facebook发布WP7游戏成就