October 20, 2014 1:30 GMT

Xamarin.Forms Book Preview Edition Available Now

The Petzold engine has been churning through the Xamarin.Forms API, and we’re pleased to announce that the first preview edition of Creating Mobile Apps with Xamarin.Forms is now available. It was distributed in print to all Xamarin Evolve 2014 attendees last week and is now available as a free download in a number of formats:


The six chapters available in the preview edition cover the history of Xamarin.Forms, solution structure, the basics of the view system and building your first Xamarin.Forms app. The extensive samples are also available for download from GitHub.

Charles also presented two talks at Evolve: XAML for Xamarin.Forms and Xamarin.Forms is Cooler Than You Think, both of which will be available shortly as videos of the sessions are published at evolve.xamarin.com.


Work continues on both Xamarin.Forms and the book!

October 19, 2014 1:00 GMT

NuGet Support in Xamarin Studio 5.5

New Features

  • Package version constraints in packages.config files are now supported
  • Xamarin Components can now have NuGet package dependencies

More information on all the new features and changes in Xamarin Studio 5.5 can be found in the release notes.

NuGet Package Version Constraints

NuGet allows you to define a range of package versions that are allowed in your project using the allowedVersions attribute in the packages.config file.

  <package id="Newtonsoft.Json" version="5.0.1" allowedVersions="[5.0,6.0)" targetFramework="MonoAndroid44" />

In the above packages.config file the project has Json.NET 5.0.1 installed and will only allow updates to versions of Json.NET that are below 6.0.

When you open the solution in Xamarin Studio, and check for updates is enabled in preferences, you will see updates in the Solution window that are valid given the constraint defined in the packages.config file. In the screenshot below an update is shown for Json.NET 5.0.8 in the Solution window even though Json.NET currently has version 6.0.5 available.

Json.NET 5.0.8 package update available shown in Solution window

When you update the NuGet packages from the Solution window Xamarin Studio will now update to a NuGet package that meets the version constraints defined in the packages.config. In the Package Console screenshot below the Json.NET package was updated, with the constraint in place, and Json.NET 5.0.8 was installed.

Json.NET package updated to 5.0.8 - Package Console output

Note that if you install a NuGet package from the Add Packages dialog you can override the constraint and install a NuGet package with a version outside of the range of the constraint.

Components with NuGet Packages

A Component from Xamarin’s Component Store can now declare a dependency on one or more NuGet packages which will be installed into the project when the Component is installed. The Android Support Library v13 Component is one example that has a NuGet package dependency.

Android Support Library v13 Component in Component Store

When you install this Component you will see that it installs the Xamarin.Android.Support.v13 NuGet package.

Android Support Library v13 Component in Solution window

In older versions of Xamarin Studio the NuGet package will not be installed and instead the project will reference the Xamarin.Android.Support.v13.dll which is included with the Component.

The NuGet packages a Component depends on are displayed in the Packages tab on the Component Details page, which you can open by double clicking the Component in the Solution window, or by right clicking the Component and selecting Details.

Android Support Library v13 Packages in Component Details page

From the Packages tab you can also install a NuGet package that a Component depends on if it was removed from the project. So if the Xamarin.Android.Support.v13 NuGet package is removed from the project the Component will be highlighted in red to indicate that there is a problem.

Android Support Library v13 Component error in Solution window

If you then open the Component Details page you will see in the Packages tab that the NuGet package is missing.

Android Support Library v13 CComponent Details page with missing NuGet Package

To add the NuGet package back to the project you can hover the mouse over the warning icon and click the Add Package button that appears in the pop-up window.

Android Support Library v13 CComponent Details page with Add Package pop-up window

October 16, 2014 6:32 GMT

The Wait Is Over: MimeKit and MailKit Reach 1.0

After about a year in the making for MimeKit and nearly 8 months for MailKit, they've finally reached 1.0 status.

I started really working on MimeKit about a year ago wanting to give the .NET community a top-notch MIME parser that could handle anything the real world could throw at it. I wanted it to run on any platform that can run .NET (including mobile) and do it with remarkable speed and grace. I wanted to make it such that re-serializing the message would be a byte-for-byte copy of the original so that no data would ever be lost. This was also very important for my last goal, which was to support S/MIME and PGP out of the box.

All of these goals for MimeKit have been reached (partly thanks to the BouncyCastle project for the crypto support).

At the start of December last year, I began working on MailKit to aid in the adoption of MimeKit. It became clear that without a way to inter-operate with the various types of mail servers, .NET developers would be unlikely to adopt it.

I started off implementing an SmtpClient with support for SASL authentication, STARTTLS, and PIPELINING support.

Soon after, I began working on a Pop3Client that was designed such that I could use MimeKit to parse messages on the fly, directly from the socket, without needing to read the message data line-by-line looking for a ".\r\n" sequence, concatenating the lines into a massive memory buffer before I could start to parse the message. This fact, combined with the fact that MimeKit's message parser is orders of magnitude faster than any other .NET parser I could find, makes MailKit the fastest POP3 library the world has ever seen.

After a month or so of avoiding the inevitable, I finally began working on an ImapClient which took me roughly two weeks to produce the initial prototype (compared to a single weekend for each of the other protocols). After many months of implementing dozens of the more widely used IMAP4 extensions (including the GMail extensions) and tweaking the APIs (along with bug fixing) thanks to feedback from some of the early adopters, I believe that it is finally complete enough to call 1.0.

In July, at the request of someone involved with a number of the IETF email-related specifications, I also implemented support for the new Internationalized Email standards, making MimeKit and MailKit the first - and only - .NET email libraries to support these standards.

If you want to do anything at all related to email in .NET, take a look at MimeKit and MailKit. I guarantee that you will not be disappointed.

October 16, 2014 1:06 GMT

Xamarin Evolve 2014 Re-Cap and Videos

We had an incredible time at Xamarin Evolve 2014, and we hope that you did too!  It was amazing to have 1,200 mobile developers all in one place to learn and celebrate mobile development.  And we hope that those of you who joined from 99 countries to watch the live stream found the sessions educational and inspiring.

Miguel de Icaza on stage during the Xamarin Evolve 2014 Keynote

If you missed the Keynote, or if you just want to re-live the excitement of the incredible announcements made there, the Evolve 2014 Keynote video is now available.

Watch Evolve 2014 Keynote

The Big Announcements

Our mission is to make it fast, easy and fun to deliver incredible mobile apps, and with these Xamarin Evolve 2014 announcements, we are bringing to you the world’s best solution to build, test and monitor your mobile apps:

  • Xamarin Insights: In the Keynote, we announced the release of Xamarin Insights, a real-time monitoring service that helps
  • Xamarin CEO Nat Friedman on stage during the Xamarin Evolve 2014 Keynoteyou improve your apps by tracking crashes and exceptions, and by providing insights into what is happening with your live users.

  • Xamarin Platform Previews: We announced 3 very exciting platform previews that we are making available immediately.
    • Xamarin Android Player: We tackled the single greatest pain point in Android development - the outdated, clunky, slow experience provided by the standard Android emulator. Our new Xamarin Android Player gives your apps the shortest startup time and best possible performance through hardware-virtualization and hardware-accelerated graphics.
    • Xamarin CTO Miguel de Icaza on stage at the Xamarin Evolve 2014 Keynote

    • Sketches: Sketches is a lightweight environment to explore the immediate effects of the code you write. Sketches are ideal to learn new APIs, prototype ideas, and quickly iterate on designs. When you are happy with your code in a Sketch, you can easily copy it into your app. You can also take snippets from your open solution and study them in this isolated live coding environment, making Sketches an incredibly powerful tool for debugging.
    • Profiler: The Xamarin Profiler helps you dissect, analyze, and polish your C# mobile applications. The profiler collects information about the managed side of your Xamarin iOS and Android applications and helps you to figure out where to spend the most time making improvements. You can use it to find memory leaks, resolve performance bottlenecks, and add polish to your applications before getting them out the door.

    Xamarin CEO Nat Friedman on stage at Xamarin Evolve 2014

  • Xamarin Test Cloud Updates: We announced some exciting new features for Xamarin Test Cloud:
    • Xamarin.UITest: Our new automated UI testing framework that harnesses the power of the C# language to create beautiful, readable, first-class test code with all the power of the .NET framework.
    • Improved Capture Tools: Screen recording in Xamarin Test Cloud enables developers to see video playback of an app running through its test cases, capturing the full testing flow, including animations.
    • Test Execution Enhancements: One of the most exciting announcements for Xamarin Test Cloud is hyper-parallel test execution. Currently, when you submit a test run to 10 unique devices, those tests happen at the same time across the devices, but the individual tests run one after the other. Hyper-parallel test execution takes this to the next level by splitting a test suite into chunks and executing the chunks in parallel on equivalent devices. We have seen this drop execution time from around 2.5 hours to just 12 minutes for our own tests.
  • IBM and Xamarin Partnership: Enterprise apps must have a consumer-grade front-end, an enterprise-grade back-end, and a comprehensive mobile software development lifecycle. In order to support the developers in our community building enterprise apps, we’ve partnered with IBM on two initial integrations, available now:
    • IBM MobileFirst SDK for Xamarin: pre-built software library that Xamarin and IBM developers can embed in their mobile apps to connect, secure and manage the apps using IBM Worklight, a part of the IBM MobileFirst portfolio.
    • IBM MobileFirst Add-Ons for Xamarin Studio and Visual Studio: Extensions that enable developers to configure and access the IBM Worklight server from a single environment.
  • Xamarin.Forms Components Ecosystem: Six major .NET component vendors have transformed over 140 existing charts, graphs, gauges, and grids into Xamarin.Forms-compatible, cross-platform mobile controls. Our component vendor partners have created beautiful UI controls that enable mobile developers to create native user experiences that meet the increasing demands of mobile enterprise apps, while saving countless hours developing these views for multiple platforms.

The rest of the conference session videos will be rolled out over the next few weeks, so stay tuned for more great Xamarin Evolve 2014 content!

October 15, 2014 11:29 GMT

Xamarin Insights : Unobtrusive mobile analytics

At the Xamarin Evolve 2014 conference, Xamarin announced their new mobile analytics solution, Xamarin Insights. When you add Insights to your mobile application, you can start tracking exceptions, crashes, user identities, and application events.

One of the best features of Insights is the ability to track the user's actions through the app to be able to trace the conditions that led to an exception. All too often, users will experience an error or, even worse, an app crash. Rarely, these users will email the developer and tell them about the crash, but don't remember any useful information that would help to recreate the exception. By adding calls Xamarin.Insights.Track() to our methods, we can track the events leading up to a particular crash.

Typical Usage

public async Task GetData ()  
    Xamarin.Insights.Track ("Enter GetData");

    /* Implement Method */

    Xamarin.Insights.Track ("Exit GetData");

private async Task GetLocalData ()  
    Xamarin.Insights.Track ("Enter GetLocalData");

    /* Implement Method */

    Xamarin.Insights.Track ("Exit GetLocalData");

private async Task GetRemoteData ()  
    Xamarin.Insights.Track ("Enter GetRemoteData");

    /* Implement Method */

    Xamarin.Insights.Track ("Exit GetRemoteData");

While this does work, it adds a lot of unnecessary noise to the code. Instead of adding line after line of analytics tracking to every method, I prefer to get that boilerplate code out of the way, and let the code focus on the problem at hand.

As I've shown before, I get a lot of use out of Fody in my mobile apps. Fody allows us to control the build time compilation and change the outputted assembly. In this case, we can use Fody's MethodDecorator package to move the Insights tracking logic into a method attribute.

Adding Fody

We'll base our custom attribute on Fody's MethodDecorator attribute, which we can add to our project from Nuget.

Install-Package MethodDecoratorEx.Fody

NOTE : There are two Fody MethodDecorators on Nuget. I'm using MethodDecoratorEx

You'll need to add the declaration to the FodyWeavers.xml file as well.

<?xml version="1.0" encoding="utf-8" ?>  
    <MethodDecoratorEx />

I wrote up instructions on using Fody with Xamarin Studio

Create Attribute

Next, we'll create a custom attribute to wrap up the Insights code. Each time we enter or leave a method, we'll make a call to Xamarin.Insights.Track().

using System;  
using System.Reflection;  
using MethodDecoratorInterfaces;  
using ArtekSoftware.Demos;  
using Xamarin;

[module: Insights]

namespace ArtekSoftware.Demos  
    [AttributeUsage (
            | AttributeTargets.Constructor 
            | AttributeTargets.Assembly 
            | AttributeTargets.Module)]
    public class InsightsAttribute : Attribute, IMethodDecorator
        private string _methodName;

        public void Init (object instance, MethodBase method, object[] args)
            _methodName = method.DeclaringType.FullName + "." + method.Name;

        public void OnEntry ()
            var message = string.Format ("OnEntry: {0}", _methodName);
            Insights.Track (message);

        public void OnExit ()
            var message = string.Format ("OnExit: {0}", _methodName);
            Insights.Track (message);

        public void OnException (Exception exception)
            Insights.Report (exception);

Add Attribute to Methods

Once the attribute is defined, all we need to do is decorate the methods that we want to track. Notice that the implementation of each method is focused simply on the method's logic and not Insights tracking.

public async Task GetData ()  
    /* Implement Method */

private async Task GetLocalData ()  
    /* Implement Method */

private async Task GetRemoteData ()  
    /* Implement Method */


This may seem like a lot of extra overhead, especially since we're calling out to a remote server. I asked the Xamarin Insights team about this, and got the following answers.

  • When does Insights send its data?
    • If Insights detects a wifi connection then generally we feel free to send data as often as we like, if we are on a Cellular connection we wait a very long time before sending data
  • Does Insights.Track immediately call the server, or are the calls batched up?
    • All data is batched up for a few seconds before sending out to the server
  • Do Insights.Track and Insights.Report call the server asynchronously, or are these blocking calls?
    • All API calls are essentially async, any Insights activity happens in a background thread
  • If queued, does the queue persist across restarts of the app? Restarts of the device?
    • All insights data is journaled to disk, this means track/identify/report/crashes/everything is persistent across restarts. We send out the old data whenever we have a good opportunity to do so, usually after we send out some new data successfully.


The end result of this is that we get really detailed tracking of the events that lead to an exception. This will make finding and fixing errors in our apps faster and more efficient. We get the details of constant tracking without littering our code with tracking calls.

October 14, 2014 6:16 GMT

Standing all day

This article (and sadly I don't remember how I got to it) really struck a chord with me today.

As part of getting my feet wet, my principal suggested I “be” a student for two days: I was to shadow and complete all the work of a 10th grade student on one day and to do the same for a 12th grade student on another day. My task was to do everything the student was supposed to do: if there was lecture or notes on the board, I copied them as fast I could into my notebook. If there was a Chemistry lab, I did it with my host student. If there was a test, I took it (I passed the Spanish one, but I am certain I failed the business one).

I could not believe how tired I was after the first day. I literally sat down the entire day, except for walking to and from classes. We forget as teachers, because we are on our feet a lot – in front of the board, pacing as we speak, circling around the room to check on student work, sitting, standing, kneeling down to chat with a student as she works through a difficult problem…we move a lot.

But students move almost never. And never is exhausting. In every class for four long blocks, the expectation was for us to come in, take our seats, and sit down for the duration of the time. By the end of the day, I could not stop yawning and I was desperate to move or stretch. I couldn’t believe how alert my host student was, because it took a lot of conscious effort for me not to get up and start doing jumping jacks in the middle of Science just to keep my mind and body from slipping into oblivion after so many hours of sitting passively.

I was drained, and not in a good, long, productive-day kind of way. No, it was that icky, lethargic tired feeling. I had planned to go back to my office and jot down some initial notes on the day, but I was so drained I couldn’t do anything that involved mental effort (so instead I watched TV) and I was in bed by 8:30.

That last bit, especially, is how I used to feel at the end of a day at work, and how I felt all thru my university years.

I also do today - today has consistend of being up at 5am, on a ferry at 6, in Wellington by 9, meetings until 4, back home by 8:30. All I crave right at the moment is the quiet of home, and thankfully, thats what we have (aside from the odd noisy bird and the cat).

Today is an exception tho. One day a fortnight. The rest of the time I'm standing.

Since moving to a standing desk, I've stopped having that feeling. I seldom fall asleep at my desk in the afternoon, even if I eat carbs, and I am usually champing at the bit at 6:30pm to go do some exercise. That didn't happen when I sat for 8 hours+ a day.

Thats one of the reasons why I backed this on Kickstarter

Moving to a standing desk has made some huge changes which I didn't expect. Recommended.

October 14, 2014 4:01 GMT

Ada Lovelace Day 2014

Today is Ada Lovelace day, a special occasion to recognize women in our community. I want to take this opportunity to also highlight someone exceptional I have known for a while.

Her name is Andrea Magnorsky.

Andrea Magnorsky

Andrea is an Irish .NET programmer. She’s currently following one of her passion – game development – and is closing production with her studio Digital Furnace (ex-BatCat) on their next title Onikira.

To say that Andrea is a community person is an understatement. In the span of a few years she has not only created popular event/group like Global Gamecraft (game jam contest) or Dublin ALT.NET but she is also continously looking for new ways to teach people through numerous talks and meetups like Functional Kats.

She is curious of everything and always avid to learn. These days you can see her sailing along with F# and functional programming for instance.

It’s no surprise that she was recognized several times in Ireland as a top person in her field. Microsoft also recently awarded her an MVP award.

It’s thanks to people like Andrea that I’m happy to be part of the community that is software development.


Muncho would have loved to conclude this but he had another emergency

October 13, 2014 2:15 GMT

Announcing Bike Now on Android, for Seattle's @CyclePronto Bike Share Program

Ever since I first saw Hubway in Boston I was excited for the hopes that one day Seattle would get it’s very own bike share program. Well, 2014 is the year this happens with Pronto Cycle Share is making it a reality.

I was a bit worried that there would be no official app to help track bikes around the Sound, so I decided to take up the challenge. I had a great start with Jérémie Laval’s wonderful Moyeu and morphing it for the Pronto Cycle.

Since Jérémie’s project was open source and built completely with Xamarin, it was easy for me to get off the ground running and leverage several libraries that I am familiar with.

Today, I am pleased to introduce Bike Now for Android and the Pronto Cycle Bike Share program that is launching today in Seattle.

This beautifully crafted app enables you to:

  • Track all Pronto stations on a visual map

  • See past 30 minute history of bike data

  • Favorite stations for quick access

  • Easily see stations nearby

  • Tap to navigate to a station near you

I have many more features planned for the app including Android Wear support, account history, and eventually an iOS and Windows Phone version as well. You can download the app right now on Google Play and learn more at www.bikenowapp.com.
October 13, 2014 1:30 GMT

Episode 18: Securing Mobile Apps with Troy Hunt

Security is more important today than ever, and mobile apps are no different. Troy Hunt joins us to talk about some common mistakes developers make when developing APIs and apps, and some practical approaches to securing them.

Hosts: Greg Shackles

Guests: Troy Hunt


Thanks to our Sponsors!


Raygun.io – Exceptional Error Tracking Raygun.io is the fastest and easiest way to track your application’s errors and get the level of detail you need to fix crashes quickly. Notifications are delivered right to your inbox and presented on a beautiful dashboard.

October 13, 2014 12:50 GMT

Introducing Refit 2.0

I've just released a brand new version of Refit, the portable C# library inspired by Jake Wharton's Retrofit.

What's Refit?

Refit (along with http://json2csharp.com) allow you to really quickly create client libraries for Web APIs, by defining their contract in an Interface, and letting Refit do the grunt work of implementing the API for you. Here's an example:

public interface IGitHubService  
  Task<List<Repo>> ListRepos(string user);

Now, use RestService to get an implementation of this Interface that does the work for you:

var client = RestService.For<IGitHubService>("https://api.github.com");  
var repos = await client.ListRepos("paulcbetts");  

Check out the ReadMe for a ton of great examples that demonstrate what you can do with Refit. Here's what's new in Refit 2.0:

Support for Xamarin.iOS 64-bit (#38)

Refit 2.0 uses a completely different system to generate the backing classes for your interfaces. In Refit 1.0, these classes would be generated at runtime using Castle.Core, which worked on most platforms, but fails on any Ahead-of-Time compiled platform, such as Xamarin.iOS.

Refit 2.0 instead generates classes at compile-time, by analyzing your app's source files with Roslyn, and generates a new RefitStubs.cs file that will be compiled along with your app. As well as enabling Xamarin.iOS 64-bit support, this class is easily subclassed and extended via partial classes, so customizing individual method behavior is now much easier.

Unfortunately, because of build system limitations, this method doesn't work with Xamarin.iOS 32-bit - you'll need to upgrade to the new Unified API before this will work in your app.

Support for Windows Store / Windows Phone 8.1 Universal Apps (#59, thanks @bennor)

Because of the compile-time code generation mentioned above, Refit 2.0 now has full support for WinRT (Windows Store) and Windows Phone 8.1 Universal applications too!

Observables in Refit are now Cold (#56, thanks to @balauru for some of the work)

Observables in Refit 1.x are backed by AsyncSubject, meaning that they replay a single result to subscribers, even after the network request ends. In Refit 2.0, Observables now do no work until Subscribed to, and each Subscription will generate a new network request, in line with Retrofit. Observables in Refit 2.0 now also will cancel network operations if the Subscription is disposed, allowing you to efficiently cancel requests if they are no longer needed.


var observable = someRestService.ReturnsAnObservable();  
var result1 = await observable;  
var result2 = await observable;

// result2 is just a replayed result1, the network request was made when
// we called ReturnsAnObservable regardless if anyone cared.
result1 == result2;  
>>> true


// Does nothing
var observable = someRestService.ReturnsAnObservable();

// Makes a web request
var result1 = await observable;

// Makes a *different* web request
var result2 = await observable;

result1 == result2;  
>>> maybe?

Form Property Aliasing (#55, thanks @bennor)

When POSTing bodies serialized via BodySerializationMethod.UrlEncoded, the AliasAs tag now also works on properties in the model class:


public interface IMeasurementProtocolApi  
    Task Collect([Body(BodySerializationMethod.UrlEncoded)] Measurement measurement);

public class Measurement  
    public string t { get; set; } // This isn't even the worst of them

await api.Collect(new Measurement { t = "what even is t?" });


// This part doesn't change
public interface IMeasurementProtocolApi  
    Task Collect([Body(BodySerializationMethod.UrlEncoded)] Measurement measurement);

// This stuff does
public Measurement  
    public string Type { get; set; }

await api.Collect(new Measurement { Type = "event" });  
October 12, 2014 2:44 GMT

A Tale of Connected Dots

This past week, we organized Evolve 2014 in Atlanta to talk about all things mobile with Xamarin.

Being a mobile conference, we of course made our own app so that attendees could track out the sessions and the geography of the event.

We also launched something a bit different in the form of a treasure hunt app. Thanks to Estimote, we used a combination of iBeacon and QR codes spread throughout the conference intertwined with challenges along the way until you reach the end of the quest and a special prize.

The main interface of that quest app is a serie of connected dots:

Evolve Quest screenshot

As you progress through the game, the content scrolls naturally to reveal more odd-shaped arrangement of those dots.

Originally, this screen was just a big tall image containing everything. This is suboptimal on Android for a couple of reason like some graphic chip not supporting big “texture” or simply the need to rescale at runtime on most screen.

Ultimately it’s also not fun because there is really nothing you can do with a big image.

Hint: this is NOT what we shipped (on Android at least).

Rather, what attendees could see on their Android phone at the conference was this:

A much more satisfying, softly animated, connected system of dots. The current game position is also highlighted with a discrete pulse.

We will open-source the entire Quest application at some point but I wanted to share how we did that specific bit that is entirely exclusive to Android.

View Source Code

Since this is a really custom animation, it’s a bit different than the other type of animation samples I have already shown.

For this type of thing, I usually rely on a very simple animator that gives me a floating value between 0 and 1 so that I can do my own tweening in code. I also manage to pass this value by hijacking one of the standard view animatable property so that I don’t need to expose more information to the Java bridge:

// Interpolator instantiation
shiverAnimator = ObjectAnimator.OfFloat (this, "scaleX", 0, 1);
shiverAnimator.RepeatCount = ValueAnimator.Infinite;
shiverAnimator.AnimationRepeat += (sender, e) => shiverIndex++;

// Property hijack
public override float ScaleX {
	get { return currentShiverInterpolation; }
	set {
		currentShiverInterpolation = value;
		Invalidate ();

In our case, I then use this value to compute for each drawing pass an offset that is added to the base position of every dots:

// Expressed in dp units
int[] shiverOffsets = new[] { 9, 3, -8, 4, -7, 6 };

// Extra applied offset code
int ApplyShivering (int dotIndex, int value)
	var off = shiverOffsets [(dotIndex + shiverIndex) % shiverOffsets.Length]
		* currentShiverInterpolation;
	value += (int)Math.Round (off);
	return value;

The wave that you see on the highlighted pin comes from a GradientDrawable that I create from a shape drawable XML definition as follow:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
	<solid android:color="#99ffffff" />

The reason for using a drawable like this is to avoid redoing common drawing code and also taking advantage of the ring shape type automatic radius scaling (notice the innerRadiusRatio attribute) to create a nice spreading effect as the ring grows larger.

The ring size and color is dynamically computed from a slightly interpolated (quadratic or accelerated) value coming from our shared shiver interpolator:

var dur = shiverAnimator.Duration / 4;
var fraction = (float)(shiverAnimator.CurrentPlayTime % dur) / dur;
// Cheap interpolation
fraction *= fraction;

var rippleRad = (int)(radius * (5 * fraction + 1)) - 8;
ripple.SetBounds (x - rippleRad, y - rippleRad, x + rippleRad, y + rippleRad);

var color = Color.Argb ((int)Math.Round (0x99 * (1 - fraction)),
                        0xFF, 0xFF, 0xFF);
((GradientDrawable)ripple).SetColor (color.ToArgb ());

If you have been to my Mastering Time and Space session, you’ll likely also have detected the presence of a custom interpolator in there that is set on the shared shivering animator. The code is following:

class TriangleWave : Java.Lang.Object, ITimeInterpolator
	public float GetInterpolation (float input)
		var t = input * 2;
		return (float)(2 * Math.Abs (t - Math.Floor (t + 0.5)) * (1 - 2 * Math.Floor (t)));

This interpolator generates a triangle pattern that is repeatable (i.e. it both starts and ends at the same position for the dot) so that the animation can run continuously:

Triangle curve

October 10, 2014 6:10 GMT

Xamarin Evolve: Day 4

Some great sessions today- here are some of the highlights:

Think Like a Hacker!

This was one of the most eye opening for many, with Darren Cathey going into great detail on security and protection against app hacking techniques to a packed room. These figures were quoted:

Off the top 100 paid apps in the App Store and on Android:

Android: 100% have hacked versions available in other stores
iOS: 56% have hacked versions available in other stores

A lot of ground was covered in here, from code obfuscation to method swizzling, with some jailbreak detection and hex editing thrown in.

Azure Mobile Services

Paul Batum gave a very detailed presentation of Azure Mobile Services, covering development of the service in Visual Studio, usage of the SDK from within Xamarin iOS and Xamarin Android, and using Azure Mobile Services to call out to an on premise database - on Paul's demo laptop, all running smoothly.

Shipping Apps in China

Some of the difficulties in shipping an app to a different country in a different language were highlighted, as well as the pressing need for consideration of cultural differences.
Jonathan Peppers also talked about some of the difficulties of handling in-app purchases in China, as they're typically paid for as part of the mobile network charges and different app stores, and mentioned that an app purchased from one app store can be updated from a different app store if that second store gets the update notification out first, leading to a redirection of the revenue. One implication of this is that testing needed to be carried out over the all the main networks using active Chinese SIM card - i.e. in China.
This app store fragmentation story was very interesting given some of the points raised in the "Think Like a Hacker" presentation earlier in the day.

The day finished, once again, with a Xamarin Party - this time a southern style barbecue complete with live music and a variety of activities.