I gave this demo on Nov 4, 2014 at the Microsoft event "Mobile Cross-Platform Development with Xamarin and Visual Studio" in Hoofddorp, The Netherlands.
This is the story and the lessons we learned cretaing a succesful real-world cross-platform app, built in C# with Xamarin and Visual Studio for iPhone, Android and Windows Phone - Poollie: WK 2014
2. The Dream
Let’s make a fun app for the World Football Championship
• To learn what it takes to make a successful app
• To show off what is possible using Xamarin, Azure and .NET
• To promote our company as an App Developer
Started seriously developing 10 weeks before the kickoff of the first match
Put up a “coming soon” webpage
Little did we know…
4. The “competition” in this category
Mostly webbased systems:
• watgaathetworden.nl / ING Bank
• flexvoetbal.nl
• nationalevoetbalpool.nl
One mobile App:
• Not free
• iOS / Android, no WP
In this category, a mobile app has many advantages over a website
5. Poollie features
• User registration
• Create / search pool
• Invite players
• Notifications
• View Championship Schedule and Standings
• Predict matches, predict winners and stats
• View (live) match, calculate player points
• View player points (self / others)
• View Pool standings
• …
Even an app as simple as Poollie has a lot of features
More info (in Dutch):
Het Verhaal van Poollie
6. Poollie technology
iOS and Android: Xamarin
• Native UI
• On-device database
• REST / SignalR connection to server
• Shared Code
Windows Phone 8:
• Native UI
• Shared Code
Plain-and-simple architecture
Server: Windows Azure Website
• ASP.NET WebAPI + SignalR
• SQL Server + Micro ORM, Migrations
• WebJobs for background processes
• Service Bus to scale SignalR
• Notification Hub
7. Xamarin Platform
Apps look and feel native, because they are
Productive app development environment
Language Framework IDE
12. Marketing Poollie
A good App doesn’t really sell itself
It takes work to market an App, make people notice…
13. Success! Houston, we have a problem
• Peaked at 200.000 screen views per hour
• 100+ web api requests / sec
Statistics and exception logging are critical
14. Scaling the server
Cloud makes it possible to buy yourself out
of trouble quickly
Just click the buttons…
15. Scaling the server
More cost efficient: old-fashioned SQL data modelling and query tuning, i.e:
SELECT
ROW_NUMBER() OVER(ORDER BY Points DESC) AS CurrentPosition,
ROW_NUMBER() OVER(ORDER BY (Points-LastPointMutation) DESC) AS PreviousPosition,
PoolId, PlayerId, DisplayName, Points, LastPointMutation
FROM
PoolPlayer INNER JOIN Player ON PoolPlayer.PlayerId = Player.Id
WHERE
PoolPlayer.PoolId = @PoolId AND
PoolPlayer.PlayerStatus BETWEEN 5 AND 6
ORDER BY
CurrentPosition
16. Scaling the server
More cost efficient: old-fashioned SQL data modelling and query tuning, i.e:
SELECT
CurrentPosition, PreviousPosition, PoolId,
PlayerId, DisplayName, Points, LastPointMutation
FROM
PoolPlayer INNER JOIN Player ON PoolPlayer.PlayerId = Player.Id
WHERE
PoolId = @PoolId AND
PoolPlayer.PlayerStatus > 4
ORDER BY
RowNumber
17. Client Performance
Eliminating all web requests from the app startup
Load minimum data from local storage for initial display.
Once the app is interactive, start background load of more local data
Also start an attempt to update with online data
Optimizing Async
Performance of non-UI code with ConfigureAwait(false)
Poollie has 300 awaits in shared code.
Replacing sqlite-net / IQueryable with Json.NET / Ienumerable
Eliminate mapping layers and slow IO
More info:
Lessons Learned
18. Demo: Notifications
In-App Notifications with SignalR
Faster and more reliable delivery, free, 2-way persistent
Push Notifications with Azure Notification Hub
Always reach people
More info:
See YouTube Video
19. Xamarin Experience: Grip and Freedom
Grip: not hitting a roadblock
Performance
Memory
Look & feel
Latest platform-specific functionality
Freedom: mix and match
Develop on Mac and on Windows machines
Use Visual Studio and Xamarin Studio IDEs
Use .NET (NuGet) and native libraries
Use Shared Code Projects and Portable Class Libraries
Share view markup (Xamarin Forms) and use native markup
20. Achievements
We did allright
47000 users with on average 25000 users every day during the
championship; 2500 concurrent users at peak times.
Voted as number oneWorld Championship pool app by iPhoneclub.nl
Voted as best pool app for World Championship in Brazil by
Androidworld.nl
Selected four times as Featured App in the Dutch Windows Phone
Store
90% of the client-side code was shared across all three platforms,
while each platform had its own native designed UI
We provided continuous app updates with improvements and new
features in all three app stores, right up to the end of the
championship
21. Resources
Dutch Mobile .NET Developers Group
Xamarin Revolve: Tuesday, November 11, 2014 6:00 PM, Hilversum
http://www.meetup.com/Dutch-Mobile-NET-Developers-Group
Macaw mobile solutions
http://www.macaw.nl/
@MaartenSikkema http://www.macaw.nl/macaw/medewerkers/maarten
@VincentH_NET http://vincenth.net
Maarten: Voorstellen Vincent
.NET Framework: including libraries and open source ecosystem NuGet
NB enterprise apps:
UX drives acceptance (consumers) and productivity (enterprise)
UX is performance, stability, familiarity
You need Native to get good that (UX)
Solving hard prblems for you, cross-platform. Examples SignalR and Azure Notiication Hubs