Running MonoGame on Android Wear

Getting MonoGame projects to run on Android Wear requires a different setup than normal solutions, from emulator to asset settings.

First problem I ran into looked like below and was easily enough solved by activating the “Use Host GPU” option when creating a new emulator image.

 OpenTK.Platform.Android.EglException: Failed to find a valid GraphicsMode configuration

Since MonoGame is available on NuGet, I started by creating an Android Wear solution and adding the framework binaries. But adding the project images in the usual “drawable” folder was giving me the following error.

Could not load * asset as a non-content file

This was triggered by the lacking Content directory in my project structure, the place where all the assets should go and which ends up in the resources bundle at runtime.

Also important, I marked my assets with the “AndroidAsset” build action, instead on “Content” or “AndroidResource”.

Advertisements

Unit testing caveats

There is much controversy regarding test driven development. People do not seem to settle on the time trade-off, the London vs. State school, TDD vs BDD and the list could go on. But before diving into all of these, my first reports from the tranches of unit testing are as follows.

Behavior depending on date and time conditions

Tests should be runnable at any hour. Even if we leave the office at 6PM and everything seems to work properly, having loose DateTime variables in the tests could mean that they will fail during the automatic build that is run every night.

For example, we might want to ensure that our newsletter goes out only on Mondays. In this case, using an ICommand would make sense, because we can verify that our condition has been met before executing the action. A Command accepts a CanExecute Action that could like this one:

Func<Email, bool> canSendEmail = (email) =>
{
    if (email.DateToBeSent.DayOfWeek == DayOfWeek.Monday)
        return true;
    return false;
};

Continue reading

Zen Monday: Case sensitivity

iOS Case Sensitivity

Working with WebViews in Xamarin.Android

Showing a webpage inside a Xamarin.Android app can be done using a WebView. Here are some tips.

Using Directives

Pop science says that more choices don’t bring more happiness. Well, yeah. Turns out you have two options for creating an URL. This was half of my problem.

Screenshot 2014-01-23 00.02.11

Continue reading