Saturday, October 4, 2014

Facebook SDK for android!

So I tried to see if I could get a hang of the facebook sdk. When it implements into our game we would have to make platform specific code, that means, different code for desktop, iOS, android. More about that can be found here.

I have successfully created an facebook app, and gotten my development hash to work with the samples that I messed around with. It took a lot of time to find out the problem behind this, but it would seem that facebook uses a security measure to know that your app is indeed authenticated to your facebook app. On mac you can create this hash by typing

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64 

into the terminal. This will prompt a password, which you type in. It is then encrypted and generated through openSSL, sha1, base64 or whatnot into a hash, if you want to recreate the hash you will need the same computer and the same password.

Now I got some FB SDK sample code to work for pure android code, the problem is when we're going to do it in libGDX. I think that the best approach would be to write an interface for the desktop environment, as seen in the link above, do the android native as seen in various FB to android tutorials, and then use the Blue River Interactive roboVM bindings for iOS. This puts a lot of more work then I previously though into implementing the game into facebook, as we really chose libGDX because we wanted to avoid writing platform specific code. But this seems like the only legitimate solution here, additionally it is valuable knowledge and experience to learn to code native android and to learn bindings for the robo virtual machine.

The highscore will probably be implemented with the platform specific code, but I believe that I will start by implementing a local highscore feature with Json. Or perhaps not, we'll see.