Updated*
Hey folks,
Facebook Plugin for Unity with Windows Phone 8 support version 2.0. Yes, it’s still Free! Now your login is done through the Facebook App and the login is valid for more then 30 days! If you don’t have the app it asks if you want to download it.
I’ve provided the Source code for the Windows Phone 8 Login DLLs, both fake and real, in case you want to make changes.
Download the Unity Package here: https://bitbucket.org/chillsters/facebook-unity-sdk-with-wp8/src
NOTE: Use with caution! I have tested it but your game could crash.
The plugin is the same Facebook SDK plugin developed by Facebook but extended with Windows Phone 8 login capabilities. All the functions and method calls are the same only difference is the addition of the extra files.
So use the same function calls as you would on iOS or Android. But you still need to do some things to enable login on Windows Phone 8.
The plugin is made from the latest plugin available (v 4.3.6, build: 131121.1756) dated Dec 02, 2013.
1. Import Build Visual Studio Project in Unity.
Build your Unity project. Just like be sure to follow that steps setting up the Facebook App values; i.e App ID and App Name.
2.1 Edit your project App Manifest.
Configure your app’s manifest file (WMAppManifest.xml) to register a custom uri scheme that is of the form msft-{ProductID}, where {ProductID} is your app’s product ID (without dashes). Add the text after . It should look like this:
<Extensions>
<Protocol Name="msft-f3bde1f120174f3c8ad9ad53098243e2" NavUriFragment="encodedLaunchUri=%s" TaskID="_default" />
</Extensions>
Important note: If you have not yet submitted your app to the Windows Phone Store, be aware that the product ID used during development is a randomly assigned placeholder. After your app has been certified, it has a different product ID. In this case, submit your app first to get a product ID assigned, but select the Manual publish option to ensure that you don’t release an app that is not set up correctly on the Facebook Developers site. Once you have your final product ID, make sure you update your WMAppManifest.xml to Use the final product ID rather than the randomly assigned placeholder.
Add ActivationPolicy=“Resume” to your Default Task. It should look like this:
<Tasks>
<DefaultTask Name="_default" NavigationPage="MainPage.xaml" ActivationPolicy="Resume" />
</Tasks>
Note: If you do not add this property your game will restart everytime you try on login.
2.3 Update your app on the Facebook Developers site
You also need to enter some information about your app in the Facebook Developers site, for example, identify your application ID in the Windows Phone Store so Facebook can ensure only your app gets access tokens granted by users to your Facebook app.
- Go to http://developers.facebook.com and log in.
- Click Apps in the top navigation bar.
- Select your Facebook app in the left pane (or create a new one if you are starting from scratch).
- Click edit settings.
- Under select how your application integrates with Facebook, find the section for Windows App and expand it.
- Enter exactly the same product ID you entered in your WMAppManifest.xml file, the {ProductID} portion (without dashes) of your msft-{ProductID} custom URI scheme.
Important note: See earlier note on how the product ID is different during development and after submission. This is crucial if you have not yet been assigned a product ID.
Here’s an example of how the Facebook Developers site looks when set up.
That’s it!
Be careful when using the Login() Logout() functions though. Calling them close together can cause your app to crash.
Download the Unity Package here: https://bitbucket.org/chillsters/facebook-unity-sdk-with-wp8/src
It would be nice if Facebook was paying me to keep this plugin up to date. So I’ll try my best.
You can support us by downloading Pigs Can’t Fly. http://www.chillsters.com/pigscantfly