XHackers:Bangalore – Hands on Labs for Xamarin Android

Apr 07 2014

On  5th April, we conducted a Hands on Labs for Xamarin Android. Most of the attendees were from ASP.Net or WPF background. So, we decided to take a simple application of calculating Auto Fare in Bangalore.

We first did a WPF application that does the calculation. Later we discussed how to extract the business logic and use PCL [Portable Class Library] to host it. Later, we started an Android project and used PCL to demonstrate code reuse. Code built during the event is uploaded to XHackers GitHub a/c for reference.

Attendees were able to follow through the lab, and reproduced the results and won some cool goodies. Few people were able to publish the app to stores.

On 19th April, we will be conducting Hands on Labs for Xamarin iOS. Don’t miss this event, as we are giving away a book, couple of T Shirts and some goodies.

Way to go XHackers :)

No responses yet

Recommended Architecture for Mobile Apps

Apr 07 2014

Lets assume app needs an external database, either hosted on cloud or on premise.

Build 2 sets of REST APIs, one for Authentication and another for actual app logic talking to your database. Also host them on different server instances if possible. If attacker is trying to break the authentication server and creates DDOS attack, your app logic server is not compromised. Also make sure every REST call for the app logic is validated by a token generated after authentication

Your client side UI can be very simple. If it is web application, you can go with simple HTML, jQuery with extensive use of Templates, and client side validations. No server side code cris-crossing your HTML and jQuery calls to REST APIs for data. This also helps in packaging the same HTML, JS, CSS in phonegap apps for any targeted mobile platform.

Your client can also be a native Windows app, Web app, Windows Phone App, iOS app or Android App. All of them will just have UI related code and all of them talk to REST APIs for data. This makes the UI/UX designers to actually work without worrying too much about server side coding.

If you architecture is based on Microsoft .Net platform, you can use Portable Class Library [PCL] to encompass your REST calls to easily usable function calls. And your Windows app, Web app, Windows Phone App, iOS using Xamarin and Android using Xamarin can all call the same PCL library for data access.

Do let me know if there are better alternatives.

Hope it helps :)

No responses yet

Android on Xamarin for Windows / ASP.Net developers – III

Mar 26 2014

In most of the Windows / ASP.Net applications, if we have to send a parameter from master page to detail page, we have several ways of doing it, like Query string, POST parameters, session state, database, static class with static variable etc. In Xamarin, we can still do database and static class approach. Most commonly used approach is using PutExtra

var detailActivity= new Intent (this, typeof(DetailActivity));
       detailActivity.PutExtra ("MyData", "Data from MasterActivity");
       StartActivity (detailActivity);

On the receiving detail page you can access the Value as below

string text = Intent.GetStringExtra ("MyData") ?? "Data not available";

Hope that helps :) Watch out for more soon!

No responses yet

XHackers:Kolkata – Introduction to Android applications on Xamarin

Mar 26 2014

We are conducting first XHackers event in Kolkata on March 27th 2014. We will be introducing Xamarin, how to write simple Android apps using Xamarin. Seeing the response of this meetup, we will conduct level 100, 200, 300 sessions, hands on labs, hackathons in near future.

If you are in Kolkata, don’t miss this event.

RSVP here

No responses yet

Webcast: Enrich your Windows 8 apps Sensors and Media

Mar 22 2014

On the first day of World’s First Windows Azure Conference, 20th March, I presented a webcast on ‘Enrich your Windows 8 apps: Sensors and Media’

Essence of the talk was how to use Media like webcam and mic for capturing photos, audio and video and playing them back, Playing DRM enabled PlayReady content. Also quick demo of using sensors like Accelerometer, Compass, Gyrometer, LightSensor, Inclinometer and GPS. Also a concept called Sensor Fusion which showcases how using more than one sensor to build some cool new apps.

Most of the Windows RT enabled devices cannot run Visual Studio and if we have to test the sensors of them, Microsoft has released a set of Remote Debugging tools. You can find them at here and how to setup and debug here.

You can find the presentation at here .

All the code samples used in the demo are available at here

No responses yet

Android on Xamarin for Windows / ASP.Net developers – II

Mar 17 2014

Continuing the series, lets understand how controls are created and used

  • Just like in WPF, ASP.Net, Windows Forms, in Xamarin based android layout designer, we drag and drop controls on to the controls on to the layout screen. The code it generates is XML which can also be typed manually or controls can also be instantiated and referred completely in activity. However, the key difference lies in how we get to access the controls.
  • In WPF, ASP.Net, Windows Forms, where the UI and the related code behind, double clicking on a button in UI, it automatically wires a event handler and all controls are accessible by the names you gave.
    In Android, we have to refer to controls first by searching and assigning it to local variables using
  • ControlType localVariable = FindViewById<ControlType>(Resource.Id.ControlName);

Sounds pretty lame if you see from Windows developer’s view. But it is true decoupling of UI and Code behind. Makes sense?

Hope that helps you get started further :) Watch out for more soon.

No responses yet

Android on Xamarin for Windows / ASP.Net developer – I

Mar 15 2014

For someone who starts with Xamarin without Android knowledge, it will be a tough nut to crack. Being a .Net developer for more than 13 years, I was wondering why someone would build an Android app the way it is built. But then there are some good reasons for why it is built that way. If you are a Windows Forms/WPF/ASP.Net developer, you might find this post easy to understand the differences.

For starters, lets look at Designer and Code behind files that we know very well

  • UI designer files like .xaml for WPF, .aspx for ASP.Net , .cshtml for MVC  windows form designer files are equivalent to .axml files which are usually found in /Resources/Layout/ folder. Sometimes .xml files are also used to define the UI. Xamarin provides a UI designer for .axml and .xml files
  • Code behind files like .xaml.cs WPF, .aspx.cs for ASP.Net, controller for MVC, windows form code behind files are equivalent to activity.cs files that are usually inherit from Android.App.Activity class. Unlike the Designer and code behind are usually linked and easily identifiable in Microsoft world, Activity in Android usually links the Layouts by setting them manually in code using SetContentView like
  • SetContentView(Resource.Layout.LayoutName);


Hope that helps you get started :) Watch out for more soon.

No responses yet

Love Xamarin? Share your stories in upcoming meetup at XHackers!

Mar 12 2014

XHackers is a Gloal group of Xamarin Enthusiasts who want to share their love for Xamarin to all those who want to learn how to put Xamarin to best use.

We had our first meetup on Feb 1st 2014, group of 7 guys and 1 lady to form XHackers. We were so excited to talk about Xamarin, we forgot to take a picture :D. On March 1st 2014, we did an another meetup for introducing iOS and Android programming to bunch of enthusiasts. Started with programs on how to write ‘Hello World’ for each platform. It was a decent turn out for first public meeting. Post this event we have pushed hard to grow this community and we have crossed 100 members as of today.

Very soon, we want to conduct hands on sessions, weekend hackathons, iOS and Android App porting hackathons. Watch out for more at our Meetup page.

Now is the time for you to speak up and say what you want to hear from us. We want to hear your stories of your Xamarin Experience at our next meetup. Also let us know, how we should do our next meetup? Hands on classes? More hello world sessions? do send a mail to reachus at xhackers dot co

Also XHackers was meant to be a global group. Currently our first two meetups happened in Bangalore, India. If you want us to come to your city, do send a mail to reachus at xhackers dot co. One of core members will be visting your city for first meetup and help that city chapter started in your city.

No responses yet

ASP.Net WebAPI: simple tweaks for mobile ready project

Mar 11 2014

The boilerplate ASP.Net WebAPI code takes care of many things that one have to do manually. Sometimes, we need more to enable it be mobile consumable. Below are the things I found after searching the web while I was fixing up a sample application for mobile.


This is not enabled by default. So we get following error

An exception has occurred while using the formatter ‘JsonMediaTypeFormatter’ to generate sample for media type ‘text/json’. Exception message: One or more errors occurred.

To fix this, go to App_Start/WebAPIConfig.cs and add the following lines in the beginning of Register function.

   1:  config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling =
   2:           Newtonsoft.Json.ReferenceLoopHandling.Serialize;
   3:  config.Formatters.JsonFormatter.SerializerSettings.PreserveReferencesHandling =
   4:           Newtonsoft.Json.PreserveReferencesHandling.Objects;

Cross-origin resource sharing (CORS)

Couple of links will help in this regard



Simplest configuration could be to install Microsoft.AspNet.WebApi.Cors NuGet package.

Hope it helps :)

No responses yet

Missed MWC 2014? Mario Tapia has come to your rescue

Mar 11 2014

Reposted with permission of Mario Tapia. Hope some of you find ideas, inspirations, and new startups may be :)
MWC 2014 – 7 years in perspective

by Mario Tapia – MobileMonday SV
This year marked my 7th time attending MWC and in that time the world has turned upside sidedown.
Appstores & the OS
The emergence of appstores from the OEMs and growth of Android and iOS took the industry by complete surprise.   OEMs and Operators that so eagerly adopted Android were not aware that they were creating a monster that they soon would regret.  The same goes for iOS, where concessions on data plan revenue sharing and zero rev share on appstore transactions where made by operators so they could get the exclusive on the iPhone for their market.   In hindsight, its a pity to see how the largest operators in the world fed partners that would soon strangle them like a constrictor.    For the developer this was a liberating change in the ecosystem allowing a 2 person startup to compete with likes of EA, Glu, Digital Chocolate, Gameloft, if some of you don’t event know who these are then I have proven my point, they were the Rovios, and Zynga’s of 2007.
Today we see operators and OEMs struggling to create new ecosystems like FireFox OS, and Tizen so they can escape the dependency they have on Apple and Google.   Each competing OS had large booths this year with a few other emerging OS’ like Canonical and Jolla present in the midst.   We can look forward to seeing larger booths and presence as these OS’ gain traction.
To further support my view of how things have been disrupted, Nokia announced the Nokia X, run on Android?   Yes, the former giant that was acquired by Microsoft to help them sell Windows devices is now selling Android devices.  Seven years ago had you told me this, I would have said you were smoking crack,  I wasn’t expecting this, but then again Nokia never ceases to surprise me.
Mobile security has slowly been growing at MWC.  With very little engagement from small players in 2007 to major participation from the usual suspects to some new ones in 2014.  SAP was out in full force and was featuring key partners in the ecosystem.  AirWatch literally had an acre of floorspace, I think the CEO knew that the VMware deal was going through that week and they wanted to have a huge presence, I believe every single AirWatch employee in the office was flown in for the conference.  The $1.5B acquisition for the BYOD solution is not as sexy as the $19B for What’s App, but I think it has a more solid business with awesome fortune 500 clients.
The Connected World
This year the Internet of Things had the largest presence to date. The industry has just got another injection for growth, and look out for the IoT to really explode this year.  Displays featuring the connected home, connected car, wearables and mHealth could be found almost everywhere.  We had the connected city by AT&T and other operators, AT&T also was displaying its connected car program that rolls up into Ralph De La Vega their CEO.  The connected car could be seen in many booths,  QNX had an awesome display of the future dash at Qualcomm’s booth built on the SnapDragon platform that was placed in a Mercedes. (check it out - Qualcomm Automotive in Mercedes Benz at Mobile World Congress 2014).  Audi and BMW also had a presence showing off their connected car projects.
The wearables were in full force with fitbit and others on display.  Sony announced the Smartband, Samsung announced the new Gears and they aren’t Android, they are Tizen based.  Even Huawei jumped on the wearable bandwagon with its TalkBand.
Internet.org & Zuckerberg
Zuckerberg gave an interesting keynote on creating zero rated services in emerging markets that would provide free data services to all users,  of course the plan starts with FB only services being zero cost, but he has plans to add other services like wikipedia, weather, etc.
His vision to connect the world is noble but in my opinion the operators don’t see this altruistic vision.  Monetizing this is a hard value proposition because how can you truly correlate a conversion of a free data user to a paying one.   I don’t think operators are going to be eager to engage on this unless they are convinced of the value proposition, event with data, its a battle.
Its not the first time this has been done,  Yahoo has done this for key sites with operator partnerships and FB did this in 2010 with 0.facebook.com.     I do believe that giving users a taste of a mobile internet experience that don’t see the benefit today will convert them to data users.  Here’s why,  while at Yahoo I saw this affect in action.  Vivo, a Brazilian operator had an outage in part of the network that billed data,  it was out for almost a month. During this time Vivo had a 10x increase in data usage causing other network load issues, but the data showed that when data was free users consumed more, way more, with an addition of new data users as well. Vivo did get its billing services online and went back to charging ridiculous data fees while really never learning anything about this experience.   I do hope this project goes well in bringing the next 1 Billion users online.
FYFN (Four Years From Now)   MWC welcomes the Startups and Innovation
The FYFN exhibition is set in the old fair grounds where MWC was once held.  In an effort to make use of this great space and also spur up a new event that would remain in Barcelona four year from now when MWC most likely will move to another city, hence FYFN.   This new event focuses on the innovation and startup world by featuring fast-pitch sessions, founder interviews, and investor pitch sessions.   SWELL had their startup fast pitch in front of Unilever and Sony Execs, Di-Anne Eisnor, Waze and John Malloy, BlueRun Ventures shared their stories on how Waze met BlueRun through to acquisition. Many more panels were held, see the website for a comprehensive list.  I’m positive that this event will grow and get better over time.
All of this is an attempt to recreate a Silicon Valleyesque ecosystem in Barcelona.  The formula of what makes Silicon Valley a magical place cannot be replicated, many try and Europe has many of these elements but lacks two important ones.  1) Investment from industry entrepreneurs. Europe is plagued by bad investment deals by financial institution investors and not by those that are from industry making investments for the sake of fostering the industry.  2) Altruism, helping others with nothing expected in return.  Our culture of connecting people, introductions, and helping other entrepreneurs is unique, something the world could indeed try to replicate.
Yeah, there were some phones there, but I don’t think anyone really cared.  Connected devices and software were really the center of attention this year.
Party Party Party
I missed covering all the parties, mixers, and fringe events, but I’ll leave that up to you to experience first hand at MWC ;)   Check out the pics from theMobileMonday Mixer and the What’s App Party with Psy.

No responses yet

Older posts »