Wednesday, 5 February 2014

Introducing Buddy.com into your existing App

As some of my readers will know I'm in the process of creating a bunch of Windows 8.1 apps. 

What do I use for the Back End?

One of the apps I hope to create is a companion app to a Windows Phone App.  To make that work I'm thinking to use buddy.com as my social back end.  It provides me with authentication and web services for uploading GPS points of interest as well as photos and other items.

Because I joined DVLUP.com and joined what was then called the Premium Developer Program, I basically got unlimited api calls to buddy.com.  That means, as near as I can tell, it is free.   Free is good.  I love free!  So for now I'm exploring how I can build everything I need on the buddy platform. 

Start out slow and Plan Plan Plan

So, once I picked the platform it was time to start building something.  But wait...  maybe I should think this through first.  I have to admit that the platform is really easy to call.  I had web service calls going out to buddy using their API installed through NUGET almost immediately.  Very easy.  But what calls to make is the tricky part.  Just because some back end offers all this infrastructure for managing users and data doesn't mean you have nothing to do.  Basic intelligence as far as logging in must be dealt with.

You have to get the user to register first.  What info do you want to collect.  Buddy's basic registration is username and password.  But you CAN also add email, gender, location and a bunch of other stuff.  Do you want just the basic info.  I thought so.  But then I forgot my password.  Crap... what do I do?  I can't ask for a change in password if the back end doesn't know my email address.  Other information might be necessary eventually too.  Look at all the options and plan it out.

You also must always be thinking about ease of use.  No user wants to be nagged all the time.  Do you cache the username and password locally?  Well, actually you don't have to.  Always ask the user if they want to auto-logon, then if they do, buddy provides a "token" when you register or even just logon that you can cache.  You can use that to logon and so the uid and pwd need never be remembered.  You need to give them a way to logoff or disconnect and also re-logon if the token is lost but that's pretty easy.

Reuse, Reduce, Recycle

As with all code you write, put it in a library.  I create a User Control for Windows Phone that handles all the management of logging on, registration, token storage, etc.  Now all I have to do is include that control and I can then add functionality for all the other communication I want to do.  you can do it with a class too.  In fact I may do that as the thing becomes for complex.  However keep in mind that you will use this over and over, so consider that when you build.

So Far So Good

So far, everything is looking good.  However I have yet to get into the meat of things.  I have only built the membership management bits and need to next work on the actual data interaction and sharing.

Coming soon to a blog near you!