Keen IO, whats that?
We all know what Windows Phone 8.1 is. Read below,
I have developed a game for Windows Phone 8 in February named DotShake, its a very simple game, by shaking your phone, you move a mark ( I call it a ball) up. It had more downloads but many of my friends said the game logic is good but its yet need some functions to call it as a full game. Yes that game does not feature a background music and does not have a leader board. Adding background music is not a great deal. But adding Leaderboard is the big one as I need to buy a online host to store the data but unfortunately I couldnt find any such services for free. Last week Facebook suggested me a page named “Keen IO” and my first thought after seeing it was, “It should be a Node JS library” I went to the page because I am learning Node JS these days so I wanted to know about that library. But (un)fortunately it wasnt a Node JS library but it “lets developers build scalable analytics features directly into their mobile & web apps.” as they claimed in Facebook page and simply it provides “Analytic for developers”.
This Keen IO does not provide you a dedicated server to host your database (and gives the maintenance headache) but simply this provides an API using that you can send all your data – any event, from any source, and as much as you want to their servers and analyze them as your needs. This supports almost all languages and platforms. This is quite simple. This is very quite simple. This is very very quite simple…. This is (n-1)very quite simple. Give AWESOME analytic methods grab exactly the data you need. and the COOL FEATURE IS, THIS GIVES FREEEEEE ACCOUNT FOR DEVELOPERS “”yyyaaaaaayyyyy”” \o/\o/\o/\o/\o/\o/\o/\o/\o/
Developers can add up to 50,000 events per month.
Events? what are them
Events is a (okie, I am copy pasting the description as in Keen IO Docs)
Events are actions that occur at a point in time. These actions can be performed by a user, an admin, a server, a program, etc. Events have properties. Properties are the juicy bits of data that describe what is happening and allow you to do in-depth analysis. When we talk about “event data” we mean events and all the properties that you send along with them.
Events are pretty simple concept. Lets take my game leaderboard example, here I want to post the scores of every user of my game before he exits the game. This is called events, the post action by my game. And it has properties like “Player name”, “UniqueID” and “Score”
Events data is something, which contains properties and thats the data used to occur an event. A good events data example might be
A pretty simple JSON with properties.
Now I am porting by DotShake game to Windows Phone 8.1 with new features. To add the Keen IO to my project I executed
In my Visual Studio 2013 package manager console and got the following error
It simply says, one is the dependency package ‘Microsoft.Net.Http 2.2.18’ used by Keen IO 0.2.0 (current version by May 26, 2014) does not support Windows Phone 8.1.
So I went to Keen IO SDK’s github page, forked it and cloned it to my local repository. There I found the nuspec file “KeenClient.nuspec”, opened it and edited the dependencies with their latest version by today (26th May 2014). The previous file was looked like
and I changed the version to 0.2.1 (<version>0.2.1</version>) and lines 17 to 22 with
1) Open the Visual Studio 2013 and open “Keen.sln”
2) The sln file will show 3 folders in solution explorer they are “Keen (portable)” “Keen.Net” and “Keen.NET.Test”
3) Right click on the first folder “Keen (portable)” and select properties. You will get project properties for Keen and there select Library -> click on Change button -> tick “Windows Phone 8.1” -> Click ok
4) Select “Release” solution configuration and Start the solution (you will get error message as there is no UI to start the process. Instead of hit Start, you can build solution with F6)
If you get any error “Error 1 This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567.”. —-> Right click on the solution ‘Solution ‘Keen’ (3projects)’ and select “Enable Nuget package restore”.
5) Do the above step for both other folders “Keen.Net” and “Keen.NET.Test”
Now the Keen client is WP8.1 ready 😉 #WOW
Re open ‘KeenClient.nuspec” file and replace 26th and 27th line with
(ie) we are adding
wpa81 here, in both of these lines. This indicated the current NuGet package (KeenClient.0.2.1.nupkg) is available for Windows Phone 8.1 as well.
Now I have to make a new Nuget Package with the current nuspec file for that I have donwloaded Nuget console from here and pasted it to the current work folder where I have cloned the the Git repo.
After downloading I get the command prompt for the work folder and entered
this command updated the current Nuget.exe to the latest version, and executed
this is the command to make Nuget package (.nupkg) with the .nuspec file. Thus this will create a file “KeenClient.0.2.1.nupkg”
Now we have the Nuget package with the latest versions of dependencies. Next step is use the Nuget package in our solution. For this, we have very simple steps
1) Go to the project where you want to add the new nuGet package and Go to Tools -> NuGet package manager -> Package manager settings
2) Select “Package Source”
3)You will get a dialog box like above. In the dialog box, click the “+” button marked in red colour, give the name and give the directory of your work folder as marked in green colour then click Update button. I have given the name as “LocalFeed”. Finally click OK and you ended up with the below
Now click OK to come out.
4) Go to Project -> Manage NuGet packages
5) You can see a category called “LocalFeed” (or whatever you have given as the name in the above step) under “Online” and if you click that. you will see the new Keen IO client (v 0.2.1 with all new dependencies)
You can re-check the version (marked with red) and dependencies (marked with green)
6) Now hit ‘INSTALL’
7) It will ask for something there hit “Accept”
It will be installed and thats all .. wow..
Finally, The DEVELOPMENT part
Development is simple thing for developers, yes exactly. Just refer https://github.com/keenlabs/keen-sdk-net link and there, you can see simple steps to integrate this with your app and get services from Keen IO.
I have made all the changed to my Git repo forked from Keenlabs and sent the pull request as well. Thats my first major FOSS contribution.