Native iOS & Android Development for the C# Developer with Xamarin

En este curso de 4 días se intentará dar un pantallazo general sobre el mundo mobile, su distribución a nivel mundial, tips sobre que hace especial a esta plataforma y una introducción a Xamarin para el desarrollo de aplicaciones nativas tanto en Android como iOs.

El objetivo del curso, es que quienes participen sean capaces de entender todo lo que engloba al desarrollo mobile, y aquello que va más allá de la pantalla del mobile device.

Me quedan subir varios links con los videos y los archivos con  los materiales, ya los ire subiendo pero mientras tanto acá tiene las presentaciones

Xamarin iOS - apply gradient background to status bar and navigation bar

Here you have a running sample on  how to apply gradient background to status bar and navigation bar to Xamarin iOS https://github.com/vackup/StatusBarGradientBackground/

Info used:
How can I create a horizontal gradient background for my iOS nav bar?

Using Background Image in Navigation Bar

How to programmatically get iOS status bar height

Visual Studio: package did not load correctly after update extension.

If you get something similar to this:

package [XamarinAndroidPackage]Source: 'Xamarin.AndroidTools' Description: Method not found: 'Void Mono.AndroidTools.AnalyticsService.ReportContextProperty(System.String[], System.String[])'. System.MissingMethodException: Method not found: 'Void Mono.AndroidTools.AnalyticsService.ReportContextProperty.....

This might be caused by one of the common issues Visual Studio can run into with updating extensions according to https://bugzilla.xamarin.com/show_bug.cgi?id=44162 and it's right!

The solution is to Clear MEF Component Cache! Clearing the ComponentModelCache folder might help.  See step 3 on the following guide:

Also there is a Visual Studio extension to make you life easier:

This extension clears the MEF cache on disk and lets Visual Studio rebuild it. The reason for clearing the MEF cache is that it can become corrupted. This ususally happens when installing or updating extensions or other Visual Studio components.

Typical errors that can be solved by clearing the component cache are:

  • Could not load package exception
  • Could not load assembly exception
  • Composition error when opening files
  • Missing syntax highlighting of some languages in VS

Getting "#!/bin/bash: No such file or directory"

If you are getting "#!/bin/bash: No such file or directory" when trying to run a bash script on mac written on Windows, the issue is the encoding

According to http://ss64.com/osx/syntax-shellscript.html

If you get an error like "#!/bin/bash: No such file or directory", that is typically an indication that the File encoding or line endings are wrong, use an editor like VI or TextWrangler (shows line encodings at the bottom of the edit window) the script file should be Unicode (UTF-8) and Unix (LF) line endings

Configure Xamarin.iOs build on TFS

Build agent

First of all, you need to install the cross platform build and release agent for Team Services and Team Foundation Server 2015 and beyond on a mac.

I think the easiest way to do that is to you MacInACloud service (https://support.macincloud.com/support/solutions/articles/8000016614-getting-started-with-the-macincloud-vsts-build-agent-plan) but if you don't want to pay for the service and have a Mac, you must install it there.

Install Prequisites

First, ensure you have the necessary OSX (macOs) system prequisites (https://github.com/Microsoft/vsts-agent/blob/master/docs/start/envosx.md) - basically OpenSSL, Git and other stuff. You will need BREW (http://brew.sh/), so visit Brew website for install instructions

Installing OpenSLL, if the following lines doesn't work, check the installed version and use it instead of 1.0.0

ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib

Deploy an agent on OSX

After installing all prequisites, you need to install the agent.

You must configure it and run it (don't forget to run it LOL), pretty straightforward.

If everything is OK you shoul see you Build Agent is green, if it is red, then something went wrong


Creating the build

Now you have go to your TFS and create a new Xamarin.iOS. To create it follow these instructions https://www.visualstudio.com/docs/build/apps/mobile/xamarin


If you have any issues, visit these url for troubleshooting info:

Can't connect to TFS when configuring the agent

User permissions

If you face issues with user permissions:
  1. Creation issues: To create the agent, the user must be part of "Agent Queue Administrator"
  2. Execution issues "Tfs2015 Build agent error: Access denied: xxxxx\yyyyy needs Listen permissions for pool zzzzz to perform the action": To run the agent, the user must be part of "Agent Queue Users" and not "Agent Queue Administrator". This is the (http://www.codewrecks.com/blog/index.php/2015/05/09/tfs2015-build-agent-error-access-denied-xxxxxyyyyy-needs-listen-permissions-for-pool-zzzzz-to-perform-the-action/)
  3. Can't select a build queue during build definition - TFS 2015 Build’s Queue is Empty: your user doesn't have permissions to execute the queue and needs to be part of "Agent Queue Users" (https://lajak.wordpress.com/2016/03/24/fix-tfs-2015-builds-queue-is-empty/)
  4. I use Team Foundation Server on-premises and I don't see some of these features. Why not? Some of these features are available only on Visual Studio Team Services and not yet available on-premises. Some features are available on-premises if you have upgraded to the latest version of TFS. Check the available features on each version here https://www.visualstudio.com/de-de/docs/build/define/build (eg: at the time of writting this post "Xamarin component restore" is only available on Team Services)

iOS Backgrounding and Updating an Application in the Background

iOS Backgrounding with Tasks

Run tasks that don't have to die when app enters background
  • Creating Background-Safe Task: You can use this pattern anywhere in your application where you don't want a task being interrupted should the user put the app into the background. A great candidate for this pattern would be tasks such as sending a new user's registration information to your server, or verifying login information. 

Updating an Application in the Background

Update the app at regular intervals
  • Region Monitoring and Significant Location Changes Service 
  • Background Fetch 

iOS Backgrounding Guidance

Refer to the following diagram to choose a backgrounding technique


Multi Platform implementation (Xamarin.Form)

Using Messanger

Camino a la Agilidad

Este fin de semana estuve leyendo un par de artículos que me han llamado la atención.

El primero habla sobre Samsung y como una empresa de semejante tamaño está tratando de cambiar su cultura para ir más rápido, tipo startup, porque están viendo que su crecimiento se hace muy lento.
El artículo dice cosas interesantes, algunas de ellas las he tratado y debatido con varios colegas:

  • Samsung’s executives will sign a pledge to move away from a top-down culture and towards a working environment that fosters open dialogue.
  • The flagship firm of South Korea’s dominant conglomerate will also reduce the number of levels in its staff hierarchy and hold more frequent online discussions between business division heads and employees.
  • Other moves in recent years to ease a rigid corporate culture include flexible working hours, a loosening of dress code requirements for weekend work and less pressure on employees to attend after-work drinking sessions that have long been a staple of Korean corporate life.


Otro de los artículos que he leído habla sobre “The End of Agile: Death by Over-Simplification” y nombra algunos riesgos que se están corriendo por pensar que  uno tiene que ser demasiado Agile, habla sobre todo de encontrar un balance:

  • Agile was abused, becoming the biggest ever hype in the history of software development, and generating a multi-million dollar industry of self-proclaimed Agile consultants and experts selling dubious certifications
  • In my personal opinion, we will have to go back to the basics: To all the wonderful design fundamentals that were being discussed in the 90’s: the SOLID principles of OOD, design patterns, software reuse, component-based software development. Only when we are able to incorporate these basic principles in our development process we will reach a true state of Agility, embracing change effectively.


Personalmente creo que este muchacho tiene algo de razón pero no toda. Me ha tocado trabajar durante 10 años en una empresa / startup donde no se sabía muy bien el software a realizar porque el negocio todavía no estaba definido. Creo que hicimos Agile antes que Agile sea nombrado por estas latitudes (de casualidad diría yo) y fuimos creando un software que otorgó mucho valor al negocio y que permitió que la empresa crezca a un ritmo del 100% anual. Obviamente al cabo de 10 años, el software no escalaba más y tenía problema de performance por todos lados pero si no lo hubiéramos desarrollado de esa manera la empresa no hubiera crecido y quizá no hubiéramos llegado a la etapa de tener problemas de arquitectura.

Buena semana

Continuous integration using Visual Studio Online and a Bitbucket repository

Continuous integration using Visual Studio Online and a Bitbucket repository is not a straightforward task, it's not hard but definitely not straightforward.

Continuous integration is the practice to build your code everytime any member of your dev team integrates code changes to the main repository.

Integrate Visual Studio Online with Bitbucket requires a couple of thing:
  1. You need to create a web app (aka proxy*) that ueue a new build using Visual Studio Team Services REST APIs
  2. You need to configure a Bitbucket webhook to queue a new build  using the proxy. FYI webhooks "provide a way to configure Bitbucket Cloud to make requests to your server (or another external service) whenever certain events occur in Bitbucket Cloud".
  3. Configure a new build in VSO that gets the code from an external Git repository
*You need to use a proxy because bitbucket webhooks only do a POST to an URL without any configuration options.

Also you can create a VSO webhook to notify slack (and also the dev team) the result of the build