Setting up my cross-platform AIR app to publish to facebook/twitter was more challenging than I expected.
Adobe Social ANE
The Social ANE included in the Adobe Gaming SDK had three problems:
- Only works on iOS
- Not possible to force a publish to public.
- Not possible to listen for an event when publish complete.
So I had to look elsewhere for ANEs that could assist.
I discovered StickSports Social-ANE, which works almost identically to the Adobe Social ANE. It has the same advantages/disadvantages, however it resolves the third disadvantage – it IS possible to listen for an event when publish is complete.
I then looked into FreshPlanet’s ANE-Facebook. Rather than using the iOS’s built in Social support, this leverages off the facebook Graph API. Nice as nicely integrated, but more power. Once the app has logged in with permissions, it can publish, force public, and listen to an event for when publish is complete. It also works on iOS/Android, resolving the three issues with Adobe’s Social ANE(however is only Facebook, not Twitter).
However, it is quite complicated to set up. Here’s a short guide, consolidating information gathered from elsewhere.
ANE-Facebook Short guide:
To begin with, Messi has prepared a great tutorial here.
You need to create a facebook app. Ensure you have added a contact email and your app is active. A few changes have happened to the Facebook interface since Messi’s tutorial. In the Settings/Basic you need to ‘Add Platform’ and add iOS and Android.
In the iOS section:
- BundleID: the App ID in your AIR for iOS Settings in Flash, Deployment.
- iPhone Store ID: the store ID of your app, use a temporary ID until you publish your app.
In the Android section:
- Package name: the App ID in your AIR for Android Settings in Flash, General. (should begin with air.)
- Class name: exactly the same as what you typed in the Package name, followed by ‘.AppEntry’. For example if your package name was air.test, your class name is air.test.AppEntry.
- Key Hashes: This is a little tricky to get. I used the advice here to extract mine.
In the app.xml in the iPhone section replace the app ID, eg if your facebook app ID is 111111111111111 your iPhone/InfoAdditions tag should include:
<key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLSchemes</key> <array> <string>fb111111111111111</string> </array> </dict> </array> <key>FacebookAppID</key> <string>111111111111111</string>
Your Android section should include: (note for change here)
<activity android:name="com.facebook.LoginActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:label="@string/app_name" /> <activity android:name="com.freshplanet.ane.AirFacebook.LoginActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"></activity> <activity android:name="com.freshplanet.ane.AirFacebook.DialogActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"></activity>
This was a LOT more complicated to set up, but provides more power in dealing with Facebook. Also provides compatibility with Android. However does not include posting to Twitter! Which ANE to go with really lies with the needs of the project.
Did you try Milkman? It is cross platform and works quite well. Do you think freshplanets one is better somehow?
Hi pippoflash – the difference is purely price! I use Milkman’s In-App Billing Android Extension, and I agree – their ANE’s are of great quality, with good documentation and tutorials. I definitely considered purchasing Milkman’s social ANE but before purchasing I decided to have a look at free alternatives. I’d love to look at working examples or screenshots of Milkman’s social extension in action to be able to decide whether it’s worth the purchase.
Thank you for this! I was googling and “stackoverflowing” for three months! hahahah