Disclaimer: this is an automatic aggregator which pulls feeds and comments from many blogs of contributors that have contributed to the Mono project. The contents of these blog entries do not necessarily reflect Xamarin's position.

September 2

Simplified Office Integration with the O365 Unified API

Office365The world of Office 365 APIs is immense, with a plethora of capabilities that enable developers to access Office 365 and add rich functionality to their mobile apps, all from shared code. In fact, we’ve already covered several Office 365 topics, including integration of SharePoint Online, Outlook(Mail), and OneDrive, as well as authentication .

To consume these services, we followed several steps to register our native app in Azure AD, set proper permissions, authenticate, and receive an ‘access token’ using the Active Directory Authentication Library (or ADAL). Once an access token is obtained, it can be used for subsequent API calls against any of the Office 365 services listed above. Consuming a custom WebAPI secured by Azure AD is straightforward enough that you can call any of the Office 365 services by using HTTPClient and passing the ‘access token’.

There used to be a few more steps to consume an O365 API. For instance, before calling an Office 365 service API, developers were required to call Discovery Service, which “discovers” and provides different end-points for various O365 services. As you can imagine, this was a cumbersome and tedious task.

365 Preview

At Microsoft Build this year, Microsoft revealed the new Office 365 Unified API, which provides a single-unified-end-point to call any services hosted within O365.

In this post, we’ll see how we can use the O365 Unified API in a Xamarin.Forms app by reusing the sample we built in the blog post Put Some Azure Active Directory in Xamarin.Forms. You may want to revisit the blog post for reference.

Step 1: Give permission to access the Office 365 APIs

In the Azure Portal, we must set the required permissions so we can access the Office 365 services from our mobile apps. In this sample, we’ll cover the Me (the logged-in user’s details) and Files APIs. We covered these before in our post on OneDrive.

O365-Unified-01

Step 2: Call Office 365 Services

In our sample from the previous blog post, when the login button was clicked, we asked the user to authenticate. Upon successful authentication, we displayed the user’s name in a message box. We’re going to extend this same method to create a new Tabbed Page with two tabs, one to display the user’s information and the other to list OneDrive documents.

Calling the “Me” API

The Me API is all about fetching details about a user who is signed in. We can use the following code to call this API.

private async void MePageAppearing(object sender, EventArgs e)
{
    var client = new HttpClient();
    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", App.AuthenticationResult.AccessToken);
    var meData = await client.GetStringAsync("https://graph.microsoft.com/beta/me");
    var userData = JsonConvert.DeserializeObject<UserModel>(meData);
    //Set Inforation
    this.DisplayName.Text = userData.DisplayName;
    this.Mail.Text = userData.Mail;
    this.Country.Text = userData.Country;
}

When we run the app, we should see the following output, which resembles the details stored on the Office 365 portal:

O365-Xamarin-Forms-1

Calling the “Files” API

Previously, calling the Files API was part of adding the SharePoint permissions and accessing it using the discovery service. With the unified Files API, it has become much easier. The following code gives us all of the files in our OneDrive.

private async void FilesPageAppearing(object sender, EventArgs e)
{
   var client = new HttpClient();
   client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
   client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", App.AuthenticationResult.AccessToken);
   var meData = await client.GetStringAsync("https://graph.microsoft.com/beta/me/files");
   var data = JsonConvert.DeserializeObject<FilesModel>(meData);
   var files = from file in data.Value
          where file.Type.ToLower() == "file"
          select file.Name;
   this.FileList.ItemsSource = files.ToList();
}

Again, if we run the app, we should be able to see a list of files from OneDrive for Business in the app:

O365-Xamarin-Forms-2

Get Started Today

In this post, we’ve seen how easy it is to integrate Office 365 into Xamarin mobile apps using ADAL and the Office 365 Unified API. Using these APIs, it’s possible for anyone to build the next best mail, calendar, or meeting request app.

Get up and running today with the Office 365 Unified API by downloading this sample, adding your Client ID and Redirect URI in the HomePage.xaml.cs file, and registering the app in Azure AD with the proper permissions.

The post Simplified Office Integration with the O365 Unified API appeared first on Xamarin Blog.

Synapse Games frees up resources with Unity Cloud Build

Synapse Games is a small indie studio that’s hugely successful. Their games, Tyrant Unleashed and Global Assault, are consistently amongst the highest grossing in Android stores and with two additional games on the way, they’ve got a lot to do. By using Unity Cloud Build to generate and share builds automatically, the team was able to simplify their build process, free up resources, and “focus on the fun part,” as Studio Founder Alex Reeve puts it.

“Unity Cloud Build has sped up our build process from about 45 minutes of engineering time or more per build to essentially zero minutes.” Alex Reeve, Founder, Synapse Games

“Our old build process hurt us,” Reeve says. “It took up extremely valuable engineering time: Before Cloud Build, we were a very small team with only two Unity engineers, and every time we needed to initiate testing, the build process would halt [game] development time.” Distributing builds for internal testing also slowed things down considerably, as revision and change tracking was completely ad-hoc, and almost never tracked effectively. “Builds were made infrequently, which made it harder for QA to identify when a specific bug or crash started appearing,” he continues.
Cloud Build streamlined the process for Synapse Games, making it faster, continuous, and best of all, automated. “It constantly streams builds based on SVN updates, with no additional engineering resources,” Reeve says. “Distribution of builds has also become very fluid—‘Share’ links make it easy to distribute builds to a large number of developers internally. Project and QA leads all have direct access to the project.”

unnamed

All Cloud Build users have access to build management tools, which are easy and useful to the entire game development team. For QA, Cloud Build provides easy ways to view details about particular builds and compare them to one another. “QA now has a much more granular access to builds, making it much easier to see when certain bugs or crashes first started showing up,” he says. “Combined with the changelog, this helps QA communicate with project leads and engineers about specific potential causes of the problems.”

Since developing with Unity Cloud Build, Synapse Games has been able to expand from Android-only to iOS. “I spend a lot of time developing on Windows and play testing on my iOS device; this was almost impossible before, but with Cloud Build it’s a trivial step,” Reeve says. One of his team’s favorite features is that Cloud Build is inherently multiplatform, and can build to iOS, Android, and Web all in parallel: “Unity Cloud Build has sped up our build process from about 45 minutes of engineering time or more per build to essentially zero minutes.”

“Cloud Build sped up the build time in terms of labor,” Reeve says. “Builds are continuously available so we never have to pause for a big build step, and we also never have to spend the engineering resources on it.”

Synapse Studio now builds all its games through Unity Cloud Build. Reeve described the evolution from their old processes to Unity Cloud Build as “incredibly easy.” “We thought we were going to need a complicated post-build script, but… we never needed it. It only took us a couple of hours to get everything set up and get our first build up and running, and we’ve never looked back since. We had very high expectations… looking back at how it revolutionized our development process, I’d say it far exceeded even those high expectations.”

September 1

Xamarin Release Cycles

There are four major components of Xamarin's platform product: the Android SDK, the iOS SDK, our Xamarin Studio IDE and our Visual Studio extension.

In the past, we used to release each component independently, but last year we realized that developing and testing each component against the other ones was getting too expensive, too slow and introduced gratuitous errors.

So we switched to a new style of releases where all the components ship together at the same time. We call these cycles.

We have been tuning the cycle releases. We started with time-based releases on a monthly basis, with the idea that any part of the platform that wanted to be released could catch one of these cycles, or wait for the next cycle if they did not have anything ready.

While the theory was great, the internal dependencies of these components was difficult to break, so our cycles started taking longer and longer.

On top of the cycles, we would always prepare builds for new versions of Android and iOS, so we could do same-day releases of the stacks. These are developed against our current stable cycle release, and shipped when we need to.

We are now switching to feature-based releases. This means that we are now waiting for features to be stable, with long preview periods to ensure that no regressions are introduced.

Because feature based releases can take as long as it is needed to ship a feature, we have introduced Service Releases on top of our cycles.

Our Current Releases

To illustrate this scenario, let me show what our current platform looks like.

We released our Cycle 5 to coincide with the Build conference, back in April 29th. This was our last timed release (we call this C5).

Since then we have shipped three service releases which contain important bug fixes and minor features (C5-SR1, SR2 and SR3), with a fourth being cooked in the oven right now (C5-SR4)

During this time, we have issued parallel previews of Android M and iOS 9 support, those are always built on top of the latest stable cycle. Our next iOS 9 preview for example, will be based on the C5-SR4.

We just branched all of our products for the next upgrade to the platform, Cycle 6.

This is the cycle that is based on Mono 4.2.0 and which contains a major upgrade to our Visual Studio support for iOS and plenty of improvements to Xamarin Studio. I will cover some of my favorite features in Cycle 6 in future posts.

Games Made For Sharing: Social Game Design

It’s a truism that even in the era of instantly accessible content, nothing quite rivals the power of word of mouth. Social media can help us to find new trusted content to download, but maximizing your game’s social impact requires more than integrating the Facebook, Twitter, or even the Everyplay plugins into your game.

Creating a social game has the potential to bring with it huge benefits such as increased installs, increased retention, and even retention through social factors. The following chart comes from our 2014 online survey of 3000 games players and shows how sharing behaviors can impact spending.
Heavy Video Sharers

As a game designer, you have to understand not only the player’s underlying motivation to share, but his journey to engage with shared content. I’ve written about this before when I tried to classify social player engagement using “The Six Degrees of Socialisation”.

six degrees of social games

We don’t need to explore this in detail here, but essentially players are willing to engage at different levels based upon the effort, reward, and risk of doing so. Like ‘Maslow’s Hierarchy of Needs’, we have to fulfill their most basic need first before players will consider higher states of engagement. However this is actually an upside-down pyramid, as the effort involved to sustain each sunsequent state grows ever higher and involves greater personal risk. Let’s look at the kinds of behaviors we might eventually hope to get from our players.

  1. Wanderer – The lowest level of social interaction, such as using helper characters based on real players who happen to play at the same time as you (e.g. Hellfire/Puzzles & Dragons).
  2. Personal Affirmation – A simple public statement of the players’ engagement in a game. There is no expectation for others to engage back as this is a broadcast of their identity.
  3. Social Capital – An indirect benefit from some kind of display in the context of a game that reflects the taste/talent or commitment to the game. A key aspect to many IAP decisions.
  4. Making A Statement – Beyond the simple broadcast comes a more competitive declaration usually involving scores, some amazing captured content, or an act of creativity.
  5. Meaningful Communication – The start of leveraging a game to intentionally communicate to others, rather than in a gameplay context by using the game as the medium.
  6. Esoteric Lore – Games (particularly where there is ambiguous strategy) become the focal point for social debate and depth of knowledge of game Lore becomes inherently valuable.
  7. User Generated Content – When player creativity breaks the barrier of what is essential to play and creating content becomes the purpose (sometimes across other mediums).
  8. eSports – When competition becomes formalized & stratified to the level where observing professional play is as intrinsically enjoyable as any sport (often with significant prize money).

Encouraging these behaviors can be incredibly powerful as long as its authentic. For the purposes of this post we don’t want to confuse social features with ‘gift spamming’, which has almost nothing to do with genuine social communication and is essentially a derivative form of gameplay advantage. That can have its place, but it has been so overused that it has damaged player trust. Instead, we have to create the conditions which enable players to communicate and make this inherently enjoyable; but we can’t force them to use them. As much as we all want to make our game the next eSport or YouTube sensation, that is out of our hands and success only comes from our players. Every game can benefit from social design, but it takes a touch of alchemy for games to ‘Go Viral’.  It seems that this is often based on the following factors:

  • Social Zeitgeist: Timing is everything. There are countless games out there and your game has to stand apart not just in terms of play, but also in its timing with the audience. What makes your game stand out as not just the next Angry Birds, League of Legends, World of Tanks, etc., but something ready right now to replace them?
  • Social Identity: Players need ‘hooks’, which let them easily identify both themselves and all who belong to your player’s community as ‘Us’ and those who don’t play as ‘Them’. This may come from the art or playing style or even inherently in the skill curve. However, you need something which directly connects your audience and lets them stand apart.
  • Niche Lore: An incredible level of Niche Lore (detailed and specific knowledge) can be required by players in order to maximize their potential playing these games. This is especially important where there are ambiguous or asymmetrical strategies of play. Don’t mistake this for complexity, even a game like Puzzles & Dragons has an incredible depth of hidden knowledge which comes into play only in later phases of long-term play
  • Brand Reach: Scale is a vital factor in all of this, as is having both deep marketing pockets and endorsement from your existing community – YouTubers or Platform holders absolutely help to expand your reach. Scalability is not just the number of users though. It requires a depth and repeatability of game play that can last for months, or better yet, years, while still sustaining a predictable uncertainty. You need a critical mass of content and audience if the game is to gain a self-sustaining momentum.

If we want a successful game, then we can’t afford to ignore these social factors even if we don’t think our idea is likely to gain the heady heights of League of Legends or Minecraft. Benefiting from social experiences is about understanding not just how we connect players to each other, but also how to incorporate the design choices which make communication inherently worthwhile. Let’s look at a psychological model of sustaining social connections:

Interdependence Theory

This model looks at how any social relationship involves a degree of effort and an expectation of some kind of reward (love, happiness, acceptance, pleasure, companionships, etc).
If we consider our engagement with a game a social relationship, we must acknowledge that there are a lot of games out there which present themselves as having a positive social experience. If we don’t understand the delicate balance between effort and reward in our game and how we compare to others, how will we be successful at retaining users?
How we communicate with players and, more importantly, how they communicate with each other, takes on a new dimension. Just like any human relationship, communication is key to understanding how what we’re getting out of being together compares to what we would miss out on if we separated.

Interdependence

So what practical tips can we apply to our game design that will create the best potential for social sharing and retention? And of course to maximize this potential if we manage to become part of the social zeitgeist. This seems to come down to understanding how your game delivers on the following:

Replayability

Replayability is an essential aspect of any game as a service. In many eSport games, this goes as far as ensuring that the start conditions are identical every time with players choosing upgrades only during play. This is a valid strategy but it comes at a price where the game risks impacting the ongoing sense of purpose and progression for many players. These players will hit a ‘skill’ ceiling when it comes to such games and may churn earlier as a result. This approach can also directly limit otherwise useful In-App Purchases, which could have delivered not just social capital, but also good strategy options.
However, some (often MMO-style) games only unlock the best equipment as the player journeys through the game, with each new monster the player meets being slightly more difficult than the last. This can quickly unbalance the play too far away from the skill and the autonomy of players. Breaking the game strategy and progression into independent loops can mitigate this. For example if you had a game which had a preparation stage, in-play improvements, and victory conditions, then you could take the following approaches:
1) Player Preparation: The character/tools you take into play have both positive and negative aspects which affect play style.
2) In-Play Upgrade Path: Players may adjust in advance, but there are ‘standard paths’ for newer players. Make the advantages strategic.
3) Victory Conditions: Taking part and completing play should always be rewarded to give you a chance to improve. Victory itself should introduce new choices/strategies which contribute to the player’s sense of purpose and engagement, rather than simple linear improvements which equate to the player just fighting a bigger monster each time.

Competence VS: Accessibility

There is nothing quite like a challenge to create a sensation. We love the extraordinary difficulty of games like Dark Souls or Superhexagon, but these frustrating challenges eventually wear on us over time. The trouble is that the difficulty curve cannot be never ending or our players will reach a point where the effort overwhelms the rewards of success; one where they either can’t afford the time or simply don’t have the reflexes of their friends.The ability to learn how to play the game is too often poorly understood by developers who may introduce cumbersome tutorials or fail to communicate clearly enough for mass market players to feel they know how to even get started. Many games also mistake the nature of competitive play. While competition is a huge motivation for some, the vast majority of people are not motivated solely by competition. They need other things to motivate them, such as progression and narrative- You don’t want to alienate your social audience by limiting accessibility to those with sufficient skill.This becomes easier to manage when you stratify the game, allowing players to reach their own level of competence and find others of a similar level, or when you provide alternative success criteria. Remember that a player’s own goals have to feel attainable, even if they can’t compete at the very highest levels.

Emergence VS: Balance

We have talked about Replayability and Purpose as important factors to balance. If we fail, it can lead to not only sterile gameplay, but also sterile game visuals. We need our games to sparkle when they are watched by an audience. This means we need to uncover unpredictable elements of gameplay or visuals which will delight viewers as well as players – this often takes the form of effects triggered by unique combinations of actions.Consider tactics introduced with a new playable character or an emergent property of an item in gameplay, such as Acid being combined with Stone. The key to developing successful emergence is that it’s not about randomness; it’s about a set of rules having player-led uncertainty. Hill Climb Racer has consistently been one of the games with the most shared replays on Everyplay, because the emergent properties of the game’s physics always deliver a joyful result – catastrophic failure. That failure isn’t randomly imposed, as it’s an emergent property where the physics meets sensitive player controls.

The choice of attack method in a MOBA itself only becomes interesting to watch when it’s defended by another player and their choice of character. There are (usually) only 3 paths, yet they remain interesting based on how each player leverages their abilities and advantages against each other. Their teamwork, communication skills and knowledge are just as important as the game itself. All of this falls apart if the emergent properties in a game overwhelm the inherent balance of the game. If the game loses balance, it stops being fun and any emergent properties are rendered worthless.

Autonomy VS: Narrative

Games are fundamentally an expression of the player through the game where their actions help to shape their own narrative. This is what makes games different from any other media. We need this capacity in a game in order for our choices, skills and actions to make a difference. However, in many very popular games the player is either discovering the single solution setup by the designer or unlocking the narrative the game designer wants to tell.True, autonomy can’t be possible if you’re playing a character with a specific story to tell, but how can we understand what our character can do or why we should emotionally connect with them without any context? Designer-led (rather than player-led) games are largely at odds with this concept and therefore negate the benefits of social play, but that doesn’t mean that narrative doesn’t have a place in social games. As Wolfgang Volk said at Respawn 2015 “[SIC] games have rules, conflict, and character, they are already stories and any narrative we create around that should be designed to help the game and its rules be better understood”. Again this becomes easier when we separate out aspects of the game from the player setup, the in-game upgrades, and the post-play sense of purpose.

oscar rant

In the end though, there is only so much we can do to create the right conditions for social experiences. In many ways the most important tips have very little to do with game design itself.

  1. You Can’t Fake Authenticity – Engage honestly with your players, listen yet still lead.
  2. Trust Your Audience – Going social means losing control – but this is good (when moderated).
  3. Players Have Their Own Audience – Why is your game fun for your players’ friends to watch.
  4. Social Isn’t Just an SDK – It’s about how you use those tools inside your game.
  5. Social Reflects a Hierarchy of Needs – We don’t all have to make eSports games.

Think about the player’s own audience to make the most of the experience and then download the Everyplay SDK here to capitalize on shared content creation.

August 31

Join Xamarin at the Jenkins User Conference

Jenkins User Conference LogoWe’re headed to our first Jenkins User Conference in Santa Clara, CA from September 2-3, and we’d love to see you there. We’ll have members from the Xamarin team available to answer your questions, discuss your apps and projects, and show you what’s new in Xamarin Test Cloud.

The Jenkins User Conference is the world’s biggest conference for Jenkins users with a focus on using Jenkins for continuous integration and continuous delivery. Be sure to check out our guide on how to set up Jenkins as a continuous integration server and automate compiling mobile apps created with Xamarin.

Stop by our table and say hello — we can’t wait to see you in Santa Clara!

The post Join Xamarin at the Jenkins User Conference appeared first on Xamarin Blog.

Upcoming Xamarin University Guest Lectures

Whether you’ve had previous experience with Xamarin or are completely new to C# or mobile development, Xamarin University offers an extensive course library that caters to developers of all levels. The program offers live, interactive, lab-based classes taught by Xamarin mobile experts from around the world, at all hours of the day. In addition to the constantly-updated list of regular courses, subscribers also have access to Guest Lectures, which are live webinars given by notable speakers in the community.

Xamarin University CrestNeed to brush up on a subject? Attend a live session again, watch a video recording, self-study with downloadable course material, or attend a 30-minute Office Hour session with an instructor! And don’t forget—Xamarin Mobile Developer Certification is included at no extra cost with your Xamarin University subscription.

With Xamarin University, the knowledge and tools to build beautiful cross-platform mobile applications is at the tip of your finger.

Guest Lectures in September

In honor of the “Back to School” season, we’ve scheduled several special Guest Lectures in September that you can register for now:

 

james September 10th at 9:00am PST
James Montemagno – Using and Developing Plugins for Xamarin
September 17th at 8:00am PST
Pierce Boggan – Spice Up your Xamarin.Forms UIs with Custom Renderers
pierce
krystin September 24th at 8:00am PST
Krystin Stuteman – Prototyping with Xamarin.Forms
September 29th at 8:00am PST
Greg Shackles – Testing your Apps: A Crash Course
greg

 

Guest lectures are recorded, so don’t sweat if you aren’t available when they’re happening live. With your Xamarin University subscription, you’ll have access to all recorded sessions at any time.

Sounds fantastic, now what?

Head over to the Xamarin University page to learn more. From there, you can enroll for a year-long subscription or you can start a free 30-day trial, which gives you access to all of these amazing Guest Lectures throughout the month of September!

The post Upcoming Xamarin University Guest Lectures appeared first on Xamarin Blog.

August 28

Xamarin Events in September

Xamarin is back in session with tons of new workshops, seminars, Dev Days, user groups, and conferences happening this September all over the world!

September meetup-banner

Get involved this month in events near you:

Seattle Mobile .NET Developers us

  • Seattle, WA: September 1st
  • What’s new in C# 6 and F# 4! with James Montemagno and Xamarin MVP, Frank Krueger

XHackNight powered by IBM Bluemix & Xamarin in

  • Bangalore, India: September 5th – 6th
  • LEARN.HACK.WIN – a Cross Platform Mobile Hackathon

Gauteng Xamarin User Group in

  • Johannesburg­, South Africa: September 8th
  • Real World Xamarin.Forms (a case study)

Xamarin Dev Days – Jacksonville us

  • Jacksonville, FL: September 12th
  • Come learn Xamarin awesomeness with your community in Jacksonville

NYC Mobile .NET Developers us

  • New York, NY: September 15th
  • Xamarin Navigation Patterns with Xamarin MVP, Dan Hermes

Noser Engineering Breakfast ch

  • Zurich, Switzerland: September 16th
  • Noser, Go Mobile with Xamarin

Slalom us

  • Boston, MA: September 15th
  • Rapidly Delivering High Quality Mobile Experiences with Xamarin

Slalom us

  • Chicago, IL: September 16th
  • Rapidly Delivering High Quality Mobile Experiences with Xamarin

H&D International Workshops & Training Germany

  • Hanover, Germany: September 21st – 25th
  • Five days of extensive training in the world of Xamarin!

Xamarin Dev Days – Miami us

  • Miami, FL: September 26th
  • Come learn Xamarin awesomeness with your community in Miami

Be sure to check out the Xamarin Events Forum for even more Xamarin events, meetups, and presentations happening near you!

Interested in getting a developer group started? We’re here to help! Here’s a tips and tricks guide on staring a developer group, an Introduction to Xamarin slide deck, and, of course, our community sponsorship program to get you started. Also, we love to hear from you, so feel free to send us an email or tweet @XamarinEvents to help spread the word and keep an eye out for events in your neck of the woods!

The post Xamarin Events in September appeared first on Xamarin Blog.

August 27

State of TLS in Mono

This is an update on our efforts to upgrade the TLS stack in Mono.

You can skip to the summary at the end if you do not care about the sausage making details.

Currently, TLS is surfaced in a few places in the .NET APIs:

  • By the SslStream class, which is a general purpose class that can be used to turn any bidirectional stream into an TLS-powered stream. This class is what currently powers the web client in Mono.
  • By the HttpWebRequest class, which provides .NET's HTTP client. This in turn is the foundation for the modern HttpClient, both the WCF and WebServices stacks as well as the quick and dirty WebClient API.

HttpClient is in particular interesting, as it allows for different transports to be provided for it. The default implementation in .NET 4.5 and Mono today is to use an HttpWebRequest-based implementation. But on Windows 10, the implementation is replaced with one that uses WinRT's HTTP client.

Microsoft is encouraging developers to abandon HttpWebRequest and instead adopt HttpClient as it both async-friendly and can use the best available transport given on a specific platform. More on this in a second.

Mono's Managed TLS

Mono currently only supports TLS 1.0.

This is the stack that powers SslStream and HttpWebRequest.

Last year we started an effort to bring managed implementations of TLS 1.2 and TLS 1.1. Given how serious security has become and how many holes have been found in existing implementation, we built this with an extensive test suite to check for conformance and to avoid common exploits found in implementation mistakes of TLS. This effort is currently under development and you can see where it currently lives at mono-tls module.

This will give us complete TLS support for the entire stack, but this work is still going to take a few months to audit.

Platform Specific HttpClients

Most of the uses for TLS today is via the HTTP protocol, and not over custom TLS streams. This means that it is more important to get an HTTP client that supports a brand new TLS stack, than it is to provide the SslStream code.

We want to provide native HttpClient handlers for all of Mono's supported platforms: Android, iOS, Mac, Linux, BSD, Unix and Windows.

On iOS: Today Xamarin.iOS already ships a native handler, the CFNetworkHandler. This one is powered by Apple's CFNetwork stack. In recent years, Apple has improved their networking stack, and we now I strongly recommend using Paul Bett's fantastic ModernHttpClient which uses iOS' brand new NSUrlSession and uses OkHttp on Android.

On Android: in the short term, we recommend adopting ModernHttpClient from Paul Betts (bonus points: the same component works on iOS with no changes). In the long term, we will change the default handler to use the Android Java client.

In both cases, you end up with HTTP 2.0 capable clients for free.

But this still leaves Linux, Windows and other assorted operating systems without a regular transport.

For those platforms, we will be adopting the CoreFX handlers, which on Unix are powered by the libcurl library.

This still leaves HttpWebRequest and everything built on top of it running on top of our TLS stack.

Bringing Microsoft's SslStream and HttpWebRequest to Mono

While this is not really TLS related, we wanted to bring Microsoft's implementations of those two classes to Mono, as they would fix many odd corner cases in the API, and address limitations in our stack that do not exist in Microsoft's implementation.

But the code is tightly coupled to native Windows APIs which makes the adoption of this code difficult.

We have built an adaptation layer that will allow us to bring Microsoft's code and use Mono's Managed TLS implementation.

SslStream backends

Our original effort focused on a pure managed implementation of TLS because we want to ensure that the TLS stack would work on all available platforms in the same way. This also means that all of the .NET code that expects to control every knob of your secure connection to work (pinning certificates or validating your own chains for example).

That said, in many cases developers do not need this capabilities, and in fact, on Xamarin.iOS, we can not even provide the functionality, as the OS does not give users access to the certificate chains.

So we are going to be developing at least two separate SslStream implementations. For Apple systems, we will be implementing a version on top of Apple's SSL stack, and for other systems we will be developing an implementation on top of Amazon's new SSL library, or the popular OpenSSL variant of the day.

These have the advantage that we would not need to maintain the code, and we benefit from third parties doing all the hard security work and will be suitable for most uses.

For those rare uses that like to handle connections manually, you will have to wait for Mono's new TLS implementation to land.

In Summary

Android, Mac and iOS users can get the latest TLS for HTTP workloads using ModernHttpClient. Mac/iOS users can use the built-in CFNetworkHandler as well.

Soon: OpenSSL/AppleSSL based transports to be available in Mono (post Mono 4.2).

Soon: Advanced .NET SSL use case scenarios will be supported with Mono's new mono-tls stack

Soon: HttpWebRequest and SslStream stacks will be replaced in Mono with Microsoft's implementations.

Join Xamarin at GOTO London & GOTO Copenhagen

Highly regarded in the software development community, the GOTO Conference series of annual events has been firmly established in Europe since 2009. This year, for the first time, the UK is getting it’s own three-day conference at GOTO London 2015.

GOTO London 2015 – September 16th to 18th (Workshops Sept. 15-16)

GOTO London 2015 BannerJoin Xamarin Developer Evangelist Mike James on Friday, September 18 to learn about creating native apps with up to 100% cross-platform code sharing with Xamarin.Forms. We’ll also have our team of mobile experts on hand at the Xamarin booth to answer your questions and help you understand how Xamarin can help you build, test, and monitor apps. Drop by for a chat—and maybe some of our popular Xamarin t-shirts and other swag!

GOTO Copenhagen 2015 – October 5th to 6th (Workshops Oct. 7-8)

GOTO Copenhagen 2015

If you can’t catch Mike’s talk in London, you have another chance to get the lowdown on Xamarin.Forms just a few weeks later at GOTO Copenhagen 2015 in Denmark. While you’re there, don’t miss Niels Frydenholm, Senior iOS Developer at eBay Classifieds, who will be presenting invaluable advice on the topic of “Continuous Delivery of Native Apps”, including automated UI testing with Xamarin Test Cloud.

We look forward to seeing you soon!

The post Join Xamarin at GOTO London & GOTO Copenhagen appeared first on Xamarin Blog.

Easily Automate Your Xamarin.Forms Apps

When developing mobile applications, it’s extremely time consuming and tedious to manually test your app for every new feature added or bug fixed. Of course, it’s possible to test an app’s business logic with common unit testing practices using nUnit or xUnit, but what about the user interface? UITestHow can we ensure that an application’s user interface is not only behaving properly, but also looks right on the thousands of unique iOS and Android devices out in the world?

This is where automated user interface testing with Xamarin.UITest, combined with the power and scale of Xamarin Test Cloud, comes in. In the past, we’ve looked at creating tests for traditional Xamarin iOS and Android applications by setting the Accessibility and Resource IDs to gain access to user interface controls in Xamarin.UITest, and today we’ll look at how to use UITest with Xamarin.Forms apps.

Meetup Manager in Test Cloud

Accessing Controls

When creating applications with Xamarin.Forms, we create our user interface with Xamarin.Forms controls in C# or XAML. At runtime, Xamarin.Forms handles laying down and displaying the native controls for the application. Since we’re developing against Xamarin.Forms controls, there’s a special way to gain access to them in our Xamarin.UITests through a special property called StyleId. The StyleId can be set to any string that can be accessed when creating your tests and will be the same between iOS and Android, which means there is no special management of Ids when developing with Xamarin.Forms.

XAML

<Button x:Name="ButtonLogin"
        StyleId="ButtonLogin"
        Grid.Row="5"
        BackgroundColor="#F44336"
        BorderRadius="0"
        TextColor="White"
        Text="Login to Meetup"
        Command="{Binding LoginCommand}" />

C#

var buttonLogin = new Button
  {
    StyleId = "ButtonLogin",
    Text = "Login to Meetup",
    BorderRadius = 0,
    TextColor = Color.White,
    BackgroundColor = Color.FromHex("F443336")
  };

The last thing to do is to add a few lines of code in your iOS and Android applications to apply the StyleId to the native controls, which actually does expose them to Xamarin.UITest. These lines of code should be commented out for final app store submissions.

iOS Setup

Open the AppDelegate.cs file in your iOS project. Add the following lines in FinishedLaunching method after Xamarin.Forms’ Init is called:

Forms.ViewInitialized += (sender, e) =>
{
  if (null != e.View.StyleId)
  {
    e.NativeView.AccessibilityIdentifier = e.View.StyleId;
  }
};

Android Setup

Open the MainActivity.cs file and add the following lines in OnCreate method after Xamarin.Forms’ Init is called:

Xamarin.Forms.Forms.ViewInitialized += (sender,  e) =>
{
  if (!string.IsNullOrWhiteSpace(e.View.StyleId))
  {
    e.NativeView.ContentDescription = e.View.StyleId;
  }
};

Now, if I was to run a UITest and open the REPL, ButtonLogin will be visible in the tree:

LoginButtonVisible

In the UITest, the ButtonLogin can be now used to interact with the button and validate so the login screen appears:

[Test]
public void OpenLoginScreen()
{
  app.Screenshot("App Launches");
  app.Tap("ButtonLogin");
  app.Screenshot("When I tap Login");
  Assert.IsNotNull(app.Query("EntryUserName").Single());
  app.Screenshot("Login Page is Visible");
}

Learn More

To learn more about Xamarin.UITest and Xamarin Test Cloud, be sure to dive through the developer documentation and see our advanced guide for using Xamarin.UITest with Xamarin.Forms. You can also download the full source code and Xamarin.UITest for Meetup Manager, which I demoed here, on my GitHub.

The post Easily Automate Your Xamarin.Forms Apps appeared first on Xamarin Blog.

Plans for Graphics Features Deprecation

This is a heads-up of graphics related things we plan to “drop” from future versions of Unity, a.k.a. Dropping of Things for Make Benefit Glorious Future of Rendering.

Sometimes when we try to make things better (better looking, faster, more flexible, etc.), we find that some old corner case or old hardware limitations get in the way. In general, we try to keep as much as possible working between versions of Unity, but sometimes the potential benefit of removing legacy functionality is just too great and said functionality hopefully affects very few people (if any).

So without further ado, here’s a tentative list of graphics related “it will stop working” items. Note that all these are “planned” and not actually done yet, so if you really, really need them to keep on working forever, let us know!

Shaders: Drop support for “precompiled” shader assets

A “precompiled” shader is the one that effectively comes “without source code”. Instead of having readable HLSL code in there, these shaders contain already compiled shader assembly or microcode or translated shader code for several platforms.

One problem with “precompiled” shaders (if you got them from somewhere) is that they will not work on platforms that might appear in the future. Say you’ve got a shader that was precompiled for DX9, OpenGL and OpenGL ES 2.0. This shader will not work on consoles, Metal, DX11 and so on! Hence using precompiled shaders is typically a bad practice for this reason alone.

Another reason why we want to remove support for them is because we want the shader serialization format to be much more efficient in disk storage, load times and runtime memory usage. The shader format we had so far was, shall we say, fairly inefficient text-based format that resulted in long shader load times and high memory usage. In our current experiments, we’re seeing big reductions in both of these (megabytes to dozens of megabytes saved depending on shader variant complexity, etc.) by changing to more efficient shader data format. However, that makes these “precompiled with old version of Unity” shaders not work anymore. We think that’s a fair tradeoff.

Advantages:

  • Shaders take up less space in your game data files (multiple times smaller).
  • Shaders load much faster, and especially the “hiccups on the main thread” while loading them asynchronously are much smaller.
  • Shaders take up a lot less memory at runtime.
  • “Show compiled code” in shader inspector will display actual shader disassembly on DX11, instead of a not-very-usable sea of vowels.

Disadvantages:

  • Precompiling your shaders (“show compiled code” from shader inspector) and then later on using that code directly will stop working.

Affects: People who precompile shaders, and people who got precompiled shaders from someone else.

When: Unity 5.3 (2015 December)

Hardware: Drop support for DirectX 9 Shader Model 2.0 GPUs

DX9 SM2.0 GPUs are fairly old and we’d like to drop support for them! This would mean that these GPUs would stop working in your Unity games: NVIDIA before 2004 (pre-GeForce 6000), AMD before 2005 (pre-Radeon X1000) and Intel before 2006 (pre-GMA X3000/965). In short, GPUs older than 10 years or so would stop working. Looking at the data, it seems that it’s only Intel GMA 950 aka 82945 GPU that is still sometimes found in the wild these days — so that one would stop working.

Note that we’re not dropping support for DirectX 9 as a whole! Often that is still the only practical option on Windows XP, which just isn’t going away… DirectX 9 rendering support (on Shader Model 3.0 or later GPUs) will continue to be in Unity for quite a while.

Advantages of doing this:

  • Less hassle for people writing shaders. Currently, all newly created shaders in Unity are compiled to “lowest common denominator” by default (shader model 2.0) and if you want any of more advanced features (vertex textures, dynamic branching, derivatives, explicit LOD sampling etc.), you need to add things like “#pragma target 3.0” etc. If we’d drop SM2.0 support, the minimum spec goes up and you don’t have to worry about it as much.
  • Way, way less hassle for us internally at Unity. You don’t want to know, for example, how much time we’ve spent on trying to cram Unity 5 physically based shaders into DX9 SM2.0 fallbacks. We could be doing actually useful stuff in that time!

Disadvantages:

  • Unity games would no longer work on Intel GMA 950 / 82945 GPU.

Affects: Windows standalone player developers.

When: Unity 5.4 (2016 March).

Hardware: Drop support for Windows Store Apps DX11 feature level 9.1 GPUs

Almost all Windows Store Apps devices are at least DX11 feature level 9.3 capable (all Windows Phone devices are). But there were one or two devices in the past that only supported feature level 9.1, so that dragged down the minimum spec that we had to support.

Advantages of doing this:

  • All WSA/WP8 shaders will be compiled to feature level 9.3, instead of 9.1, gaining some more functionality that wasn’t working previously (multiple render targets, derivative instructions in pixel shaders etc.).
  • We get to remove quite some code that had to deal with 9.1 limitations before.

Disadvantages:

  • Your Windows Store Apps would no longer support 9.1 devices (in practice this pretty much means “Surface RT tablet”). Note that Windows Phone is not affected, since all phones have at least 9.3 support.

Affects: Windows Store Apps developers.

When: Unity 5.4 (2016 March).

Shaders: Drop support for “native shadow maps” on Android OpenGL ES 2.0

Shadow mapping can be done using either “native GPU support for it” (sampling the shadowmap directly returns the “shadow value”, possibly also using hardware PCF filtering), or “manually” (sample depth from the shadowmap, compare with surface depth to determine whether in or out of shadow).

The first form is usually preferred, especially since many GPUs can provide 2×2 PCF filtering “for free”. On majority of platforms, we know ahead of time which of the shadow modes they support, however Android OpenGL ES 2.0 was the odd one, since some devices support “native shadow maps” (via EXT_shadow_samplers extension), but some other devices did not. This meant that for any shadow related shader, for Android ES 2.0 we’d have to compile and ship two variants of the shader to cover both cases.

However, we looked at the data and it seems that support for EXT_shadow_samplers on Android is extremely rare (1-2% of all devices). So we think it’s worth it to just remove support for that; we’d just always treat Android ES 2.0 as “manual depth comparison for shadows” platform.

Advantages of doing this:

  • Less shader variants to compile, ship and load at runtime on Android ES 2.0.

Disadvantages:

  • About 1% of Android ES 2.0 devices would no longer do hardware shadow PCF sampling, but instead do a slightly slower depth comparison in the shader. Note, however, that all these devices can use OpenGL ES 3.0 which has built-in PCF, so it’s better to include support for that!

Affects: Android developers targeting OpenGL ES 2.0.

When: Unity 5.4 (2016 March).

August 26

Securing Your App with Touch ID

One of my favorite features of the iPhone is Touch ID, introduced by Apple with the release of the iPhone 5s a couple of years ago. touch-id-iconTouch ID adds biometric authentication to your device so users can touch the home button to unlock their device instead of using a pin code.

Since its initial release, Apple has added a few new ways to use Touch ID, including integrating it as an essential part of Apple Pay and adding an API for developers to use Touch ID in their apps. In this blog post we’re going to discuss how you can leverage Touch ID to create secure user authentication. We’ll include a fallback to store the password in Keychain and authenticate our users against that in cases where the device doesn’t support Touch ID.

Xamarin Studio with TouchID Design

Supporting Older Devices

Sign Up

If the device has Touch ID, we won’t need to sign the user up since the device can authenticate them for us. But to ensure we support devices such as iPhone 4, 4S, and the iPhone 5, we’ll want to ensure we’ve got a fallback in place. To do this, we’ll use Keychain to store and validate the user credentials.

I like to use UserDefaults for storing usernames to read back information when the app launches and populate the username UITextField for the user. It’s small touches like this that make an app feel more polished and help achieve higher ratings on the app store.

var hasLoginKey = NSUserDefaults.StandardUserDefaults.BoolForKey("hasLogin");

if (!hasLoginKey)

    NSUserDefaults.StandardUserDefaults.SetValueForKey(new NSString(tbxUsername.Text), new NSString("username"));


Saving the Password

It’s important to note that we don’t want to use UserDefaults here since it’s not a secure approach to saving your data. Instead, we’ll use Keychain, which is iOS’s built-in secure storage service that allows us to store passwords, keys, certificates, and more. My colleague René Ruppert has developed a helpful wrapper for storing passwords on iOS with Keychain that you can grab here and is what I’ll be using.

To save the password, we simply call ‘SetPasswordForUsername’. In this case, I have my serviceId set to ‘MySecureApp’.

Helpers.KeychainHelpers.SetPasswordForUsername(tbxUsername.Text, tbxPassword.Text, serviceId, Security.SecAccessible.Always, true);

Once we’ve done that, it’s time to set ‘hasLogin’ to true and synchronize the UserDefaults.

NSUserDefaults.StandardUserDefaults.SetBool(true, "hasLogin");

NSUserDefaults.StandardUserDefaults.Synchronize();

Validating the User Credentials

We’re now ready to validate the credentials provided by the user. To do this, we get the password from the Keychain and check that it matches the password provided. We then repeat the process with the username. If CheckLogin returns true, then we can continue loading new views.

static bool CheckLogin(string username, string password)
{
    if (password == Helpers.KeychainHelpers.GetPasswordForUsername(username, serviceId, true) &&
        username == NSUserDefaults.StandardUserDefaults.ValueForKey(new NSString("username")).ToString())
    {
        return true;
    }
    return false;
}

Adding Touch ID

Implementing user authentication with Touch ID is painless and only involves a tiny amount of code since iOS does most of the heavy lifting for us. Below is all the code required to get started.

//Lets double check the device supports Touch ID
if (context.CanEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, out error))
{
    var replyHandler = new LAContextReplyHandler((success, error) =>
        {
            InvokeOnMainThread(() =>
                {
                    if (success)
                    {
                        var newVC = new UIViewController();
                        PresentViewController(newVC, true, null);
                    }
                    else
                    {
                        var alert = new UIAlertView("OOPS!", "Something went wrong.", null, "Oops", null);
                        alert.Show();
                    }
                });
        });
    context.EvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, "Logging in with Touch ID", replyHandler);
}
else
{
    var alert = new UIAlertView("Error", "TouchID not available", null, "BOOO!", null);
    alert.Show();
}

Wrapping Up

Not all apps require a backend service for user authentication, and iOS provides lots of options for authenticating locally. If you wanted to take this one step further you could look at integrating 1Password authentication into your app. I’ve created a completed version of the demo project on GitHub, to which I’ll be adding 1Password support to in a separate branch that you can find here. Additionally, be sure to read through our full documentation on integrating Touch ID.

The post Securing Your App with Touch ID appeared first on Xamarin Blog.

IKVM.NET 8.1 Release Candidate 0

The first release candidate is finally available. It can be downloaded here or from NuGet.

What's New (relative to IKVM.NET 8.0):

  • Integrated OpenJDK 8u45.
  • Many fixes to late binding support.
  • Added ikvmc support for deterministic output files.
  • Various sun.misc.Unsafe improvements.
  • Many minor bug fixes and performance tweaks.

Changes since previous development snapshot:

  • Assemblies are strong named.
  • Fix for bug #303. ikvmc internal compiler error when trying to get interfaces from type from missing assembly reference.
  • Implemented NIO atomic file move on Windows.

Binaries available here: ikvmbin-8.1.5717.0.zip

Sources: ikvmsrc-8.1.5717.0.zip, openjdk-8u45-b14-stripped.zip

Unity Comes to Linux: Experimental Build Now Available

Hello again, lovely people!

Last month, I wrote a blog post detailing our plans for Unity on Linux.  Well, I’m back again to tell you the big day has come; today we’re releasing an experimental build of Unity for Linux!

An Experimental Build

Today’s build is what we call an experimental build; future support is not yet guaranteed.  Your adoption and feedback will help us determine if this is something we can sustain alongside our Mac and Windows builds.

Today’s build is based off Unity 5.1.0f3 and comes with the ability to export to the following runtimes:

  • Linux, Mac, Windows Standalone
  • WebGL
  • WebPlayer
  • Android
  • Tizen
  • SamsungTV

System Requirements

  • 64-bit Ubuntu 12.04 or newer (just like our player, the editor will run on most ‘modern’ 64-bit Linux distributions, but official support is only provided for 64-bit Ubuntu 12.04 or newer)
  • Modern Nvidia, AMD, or Intel graphics card with vendor-supported graphics drivers

Feedback and Issues

We’ve created a new section of the forums for you to provide feedback and report issues.  That’s the primary place where we’ll be communicating with our users who are using the Linux build, so be sure to check it out.  Crashes of the editor will pop up the bug reporter, which we encourage you to use in that case (because we’ll get the stacktrace).

That’s all for now. You can find the downloads here:

Read more about the release notes and known issues in our forum post.

Much love from Unity

Na’Tosha

August 25

Mobile Apps with Visual Basic & Xamarin.Forms

If you are a Visual Basic developer, your options for becoming a mobile developer have historically been limited to targeting Windows Phone; however, with Xamarin.Forms, Portable Class Libraries, and Visual Studio, developing iOS and Android apps entirely in Visual Basic has become a real possibility.

Last year I wrote about how Visual Basic Portable Class Libraries (PCLs) can be used in Xamarin apps. Xamarin.iOS and Xamarin.Android can access business logic written in Visual Basic PCLs, while writing the platform-specific code (including the user interface) in C# (or F#) on the Xamarin platform.

Visual Basic Xamarin.Forms

Since then we’ve released Xamarin.Forms, which makes it possible for an entire app—from business logic to user interface—to be written in a PCL and shared across platforms. This means that it’s become possible to write entire mobile applications in Visual Basic in Visual Studio using Xamarin.Forms. The Xamarin developer portal has instructions on creating a Visual Basic project from the Xamarin.Forms new project template. A “Basic” App class is shown here:

Public Class App
    Inherits Application
    Public Sub New()
        Dim label = New Label With {.XAlign = TextAlignment.Center,
                                    .FontSize = Device.GetNamedSize(NamedSize.Medium, GetType(Label)),
                                    .Text = "Welcome to Xamarin.Forms with Visual Basic.NET"}
        Dim stack = New StackLayout With {
            .VerticalOptions = LayoutOptions.Center
        }
        stack.Children.Add(label)
        Dim page = New ContentPage
        page.Content = stack
        MainPage = page
    End Sub

Once you’ve created a new project and converted it to Visual Basic (or just started with the sample) your entire application can be written in Visual Basic. The code below represents a simple ContentPage written in Visual Basic. You can use this as a basis for new pages in your apps:

Public Class Page2
    Inherits ContentPage
    Public Sub New()
        Dim label = New Label With {.XAlign = TextAlignment.Center,
                                    .FontSize = Device.GetNamedSize(NamedSize.Medium, GetType(Label)),
                                    .Text = "Visual Basic  ContentPage"}
        Dim button = New Button With {.Text = "Click me"}
        AddHandler button.Clicked, Async Sub(sender, e)
                                       Await DisplayAlert("Hello from VB", "Visual Basic.NET is back!", "Thanks")
                                   End Sub
        Dim stack = New StackLayout With {
            .VerticalOptions = LayoutOptions.Center
        }
        stack.Children.Add(label)
        stack.Children.Add(button)
        Content = stack
    End Sub
End Class

Xamarin doesn’t implement support for the Visual Basic language directly, so you can’t use Xamarin Studio for these projects; however, if you’re a Visual Basic programmer, or have existing Visual Basic code you’d like to mobilize, there’s never been a better time to get started with mobile development with Xamarin.Forms! And, of course, if you have published a Windows Phone application written in Visual Basic, there’s still time to take advantage of our free subscriptions for Windows Phone Developers promotion before August 31, 2015.

The post Mobile Apps with Visual Basic & Xamarin.Forms appeared first on Xamarin Blog.

The Unity Assertion Library

Unity 5.1 shipped with a brand new Assertion Library. In this post, we will explain what an assertion is and how you can use it to improve runtime error diagnostics in your games.

What is an assertion and why should I care?

An assertion is a method that checks for a condition. If the condition is true, the method returns and the execution continues. If something unexpected happens and the assumption in the condition is not met, a message is printed that shows the callstack and optionally a user specified message. Let’s look at an example:

//Make sure the player GameObject is active
Assert.IsTrue(playerGameObject.isActive, “Player GameObject is not active”);

If the referenced GameObject was not active, an error log message would be printed showing the callstack and specified message “Player GameObject is not active”.

Assertion message

Many developers know asserts from unit tests. In a unit tests written using the Arrange-Act-Assert pattern, it’s the final part of the test method, where you compare expected and actual results. Assertions are not just for tests, though. You can use them in production code as well to get warned, at runtime, when invariants are violated. However, not all asserts should be used in runtime code.

What about the assertion libraries from unit tests frameworks?

It is very likely that you have first encountered assertions in a unit tests framework. As an example, let’s take NUnit. NUnit has a rich and battle-tested library for asserting tests you write with it. A natural thing to ask is why wouldn’t you simply want to use this library to test your production code? There are few reasons for that and one simple answer: it’s not meant for that purpose.

NUnit assertions allow you to test many things. From simple equality comparisons through more complex operations on collections to testing throwing exceptions. That is all fine but it all makes it too slow for using it in runtime. Low level assertions need to be as lean as possible and not give any unnecessary overhead in execution. The assertion library was written to run with no extra memory allocation and unnecessary operations.

An important thing for an assertion library is the possibility to strip the method calls out from the release build. The assertions can be very useful for developers during the production, but will be meaningless for the end-users if they fail. When building your final build you would want to get rid of all the calls to assertions. You could potentially comment all of the code out, but that wouldn’t be too smart. Luckily, .NET has a conditional compilation mechanism for such situations. The assertions library is implemented with Conditional attribute that will only include the assertion call in the developer’s build of your players. It is, however, still possible to include the assertions by forcing it via a compilation option.

Last but not least, it’s common for unit test assertion libraries to be based on exceptions. An exception is thrown on a failure and the execution flow is broken. This, obviously, is not desired in runtime code. The assertion library has been integrated with the Unity logging system and in case of a failure, a message will be logged. It makes the library versatile for all the platforms Unity supports. It also means the assertions work on AOT platforms that do not support exceptions.

So, what is in the library?

The library offers a several type-specific comparison methods and a generic equality comparer. Some of the assertion methods:

  • AreEqual – generic comparer used for basic equality comparison. Uses default equality comparer.
  • AreApproximatelyEqual – approximate comparer that tolerates comparison error. Can be used to compare floating point numbers.
  • IsTrue – for quick and easy boolean variables checks.

All the methods can be found in the Assert documentation.

A cool thing about this library is it’s out-of-the-box compatibility with Unity Test Tools. Without any extra effort, the assertion will fail any integration tests calling the code guarded by them.

Extending the library

When you want to get the most out of a feature, it’s natural to want to extend it. The library’s AreEqual methods allow you to pass your own implementation of a comparer for a specific type. The comparer has to implement the IEqualityComparer interface.

The library comes with FloatComparer used for comparing floats. It also allows you to do comparison with a relative error check. This comparer is used by AreApproximatellyEqual method.

Wrap-up

Using assertion library to protect your code from bugs and undesired state is an easy and little-impact mechanism you can start using right away. The library will be improved with time and, as usual, your comments and suggestions are more than welcome!

August 24

Rapid Mobile App Prototyping with Xamarin.Forms

Creating mobile app prototypes is an important part of the design process. It’s extremely useful for developers and test users to be able to interact with a prototype in order to experience how the app will behave when it’s complete, but building prototypes can be daunting due to the large amount of time it takes. This is especially true when you’re asked to make prototypes for more than just one mobile platform, which happens more often than not. With Xamarin.Forms, though, it’s quick and easy to create user interfaces that are shared across Android, iOS, and Windows Phone.

Wireframes vs. Mockups vs. Prototypes

These terms often get used interchangeably in the mobile world. In order to understand why you might use Xamarin.Forms for prototyping, let’s go over the differences between these design terms.

Login_Wireframe

Wireframes

Wireframes are a static, low-fidelity representation of design. They’re usually in black and white, with blue sometimes used to show links and/or buttons. Wireframes should be created before mockups or prototypes, since they’re the backbone of your mobile app’s design.

Bottom Line: Wireframes are quick to create and are typically used as documentation for your project.
 

MockupsProfile_Mockup

Mockups are a static, high-fidelity representation of designs. These full-color images should look almost exactly like the final product in terms of color, icons, buttons, etc. Mockups represent the structure of information and demonstrate the basic functionalities of your app in a static way.

Bottom Line: Mockups are quicker to create than prototypes and are great for gathering feedback on the design in its entirety.

Prototypes

Prototypes are a middle to high-fidelity representation of the final product that simulates user interaction. It’s more likely that your prototypes will be middle-fidelity, meaning they won’t have to be as accurate as mockups when it comes to the design of your app. Prototypes should allow testers to interact with the app in a way similar to the final product.
Prorotype_Image
Bottom Line: Prototypes are expensive to create but are good for allowing stakeholders to preview the mobile app in its entirety.

Xamarin.Forms for Prototyping

Prototyping can be expensive and time consuming, but Xamarin.Forms lets you create prototypes for all three platforms by writing code in XAML or C# just one time, greatly reducing this pain. Xamarin.Forms also allows you to put real apps onto real devices to show off your prototypes. It empowers you to rapidly create a prototype and then put your prototype onto iOS, Android, and Windows devices so that your client or stakeholder can experience the user interaction of your app. That’s a pretty powerful tool in the design and development process.

So… Let’s code!

We are going to use the Swarm mobile app by Foursquare for our prototyping example. Here are a few screens that we should be able to easily create prototypes for:
Swarm_Screenshots

Initial Setup

Create a new Xamarin.Forms app. I’m going to name mine “SwarmPrototype”. Now, add a new Forms ContentPage XAML file named “LoginPage”.

In your App.cs file, modify the existing App() method so that our LoginPage shows up as soon as the app starts. We will also wrap the LoginPage in a NavigationPage and change some navigation bar properties.

public App ()
{
  // The root page of your application
  MainPage = new NavigationPage(new LoginPage())
  {
    BarBackgroundColor = Color.Transparent,
    BarTextColor = Color.White
  };
}

This gives us a NavigationPage, which provides some simple navigation properties so we can easily move from screen to screen through our prototype. The navigation bar will have white text to represent the screenshots above.

Login

Let’s head over to our LoginPage.xaml now. You can see it has automatically given us a content page in which we will need to add some content. First, add a StackLayout with 200 padding on top and an orange background.

<ContentPage.Content>
  <StackLayout
    Padding="0,200,0,0"
    BackgroundColor="#FFA733"
    VerticalOptions="FillAndExpand"
    Spacing="20">
  </StackLayout>
</ContentPage.Content>

Now, inside of our stacklayout, which is oriented vertically by default, we want to add a label, two entries, and three buttons. The label and the two entries will look like this:

<Label
  Text="Log in with your Foursquare account"
  TextColor="White"
  HorizontalOptions="Center"/>
<StackLayout
  HorizontalOptions="FillAndExpand"
  Spacing="0">
  <Entry
    Placeholder="Username"/>
  <Entry
    Placeholder="Password"/>
</StackLayout>

As you can see, we have a label and then two entries inside of another stacklayout. The reason I put those two entries inside of a new stacklayout is so that I could make sure the Spacing=”20″ in our main stacklayout didn’t apply to those elements. Here’s the rest of the XAML for the LoginPage:

<StackLayout
  Orientation="Horizontal"
  HorizontalOptions="CenterAndExpand"
  Spacing="30">
  <Button
    x:Name="buttonCancel"
    Text="Cancel"
    TextColor="White"
    BackgroundColor="#FFA733"
    BorderRadius="15"
    BorderColor="White"
    BorderWidth="2"
    HeightRequest="40"
    WidthRequest="150"/>
  <Button
    x:Name="buttonLogin"
    Text="Log in"
    TextColor="#FFA733"
    BackgroundColor="White"
    BorderRadius="15"
    HeightRequest="40"
    WidthRequest="150"/>
</StackLayout>
<Button
  x:Name="buttonForgot"
  Text="Forgot your password?"
  TextColor="White"
  BackgroundColor="Transparent"/>

One Last Thing

Now we have a static login page, which is a great start, but prototypes are meant to be interactive; we want the app to navigate when the user clicks the “Log in” button. In the LoginPage.xaml.cs file, we’re going to add an event handler for that button as well as a line of code to hide the navigation bar on the LoginPage.

public LoginPage ()
{
  InitializeComponent ();
  NavigationPage.SetHasNavigationBar (this, false);
  buttonLogin.Clicked += async (object sender, EventArgs e) => {
    await Navigation.PushAsync (new ActivityFeedPage ());
  };
}

In the event handler, we use the Navigation property (given to us by the NavigationPage we set up in our App.cs file) to Push a new ActivityFeedPage. You will have to add a new ContentPage XAML file named “ActivityFeedPage” for this to work.

Our login page is now good to go! If we run the app we can see that, even though we only wrote one XAML file, it looks and feels native on Android and iOS.
Login_Screenshots

Keep on coding!

I urge you to take a look at the Xamarin.Forms guides and to try creating the next two pages on your own. If you’re having trouble, take a look at the completed project on my GitHub. I will also be doing a more extensive guest lecture on this topic through Xamarin University on September 24th. Get your free 30-day trial so you can join me for this awesome rapid prototyping session!

The post Rapid Mobile App Prototyping with Xamarin.Forms appeared first on Xamarin Blog.

August 21

Test Your Way to Xamarin Evolve Contest Winners!

We’d like to extend a big “Thank you!” to everyone that entered our “Test Your Way to Xamarin Evolve” contest. With app testing at the forefront of every mobile project, Xamarin wanted to relieve some of the stress associated with UI.Testing by introducing Xamarin Test Cloud. Now that all Xamarin Platform subscriptions include 60 Xamarin Test Cloud device minutes per month to test any app, we asked to see all of your awesome apps running in Xamarin Test Cloud!

Picking a single winner for a big prize like a ticket to Xamarin Evolve 2016 is difficult. However, without further adieu, I’m excited to congratulate our Grand Prize winner, Casper Skoubo!

Casper Tweet Pic 1

The app is called “Tilbagekaldt”, which in Danish translates to “revoke” or “withdraw” and was intended as a warning service for users when the Danish Ministry of Food sends out warnings about foods that may not have been handled correctly.

Casper Tweet Pic 2

With such great submissions from the community, we couldn’t decide on just one second place winner. So, I’m happy to congratulate both of our second place winners: James Alt and Mitch Muenster, for their wonderful contributions to Xamarin Test Cloud!

And also honorable mentions to:

Sebastian Seidel

Esteban Solano

Alison Fernandes

Marcel Malik

Mark Arteaga

Pavlina Pavlova

Didn’t get a chance to partake in the contest? Not to worry! You can still take advantage of this new benefit to start automating UI testing for mobile apps written on ANY platform (not just Xamarin) on our industry-leading catalog of over 1,800 devices. Get started using Xamarin Test Cloud today!

The post Test Your Way to Xamarin Evolve Contest Winners! appeared first on Xamarin Blog.

August 20

Stugan Game Accelerator: Developers in the Swedish countryside

Sweden is a great country for game development. Companies based there such as King, EA Dice, Mojang, Avalanche Studios, Simogo and more have created and released some of the best-known and highly-successful IPs in the world. For example, just a couple of weeks ago, Rovio Stockholm released Angry Birds 2 (made with Unity btw), already downloaded by over 30 million people.

The beautiful Swedish countryside also hosts Oskar Burman’s (Rovio) and Tommy Palm’s (ex-King) non-profit game accelerator program Stugan.

Stugan – the name means “cabin” in English – gathers talented independent developers from all over the globe, from USA to South Africa or Australia. Together, they’re spending two summer months in lakeside red cabins. The program is their opportunity to make friends with developers from far away, get away from the distractions of large cities and focus on the games they have always wanted to create. But there’s also time for hiking through the surrounding woodlands, swimming in the nearby lake and an end-of-day relax in a traditional Scandinavian sauna!

3) Lake Photo

Aside from working on their games, the organisers of Stugan also organized visits from various experts from the games industry to speak to the teams. They delivered talks and gave advice to the developers on topics like PR and marketing, running a game studio or using the Arduino hardware. I had the luck and pleasure to represent Unity and visit the game accelerator at its mid-way point of the program.

I met the teams, played their creations and learned about their backgrounds, what type of game are they making and how. The majority of the projects use Unity, which gave me a chance to learn how they are using the engine, help with a few of the technical questions and gather feedback.

Below is a sample of their many in-development Unity projects, plus my impressions on what’s interesting about them in terms of input, visuals and gameplay.

20,000 Leagues Above The Clouds by That Brain (Sweden)

Ever wanted to be a captain of your own air-ship? Now you can! In ‘20,000 Leagues’ you command your own flying-vessel and explore open worlds of floating islands, sky-harbours and rival air-ships. When playtesting the current version of the game, I customized my own ship in body-size, weapons, boost-abilities and even banner logo and colors!
4) 20000above

Rosvita by Rosvita Works (UK)

In Rosvita, the visuals of the game are created by rendering 3D models of buildings in the game-world, but with a 2D detail map in the overlay. In the end, the game looks like a water-color painting with ink-work detail. The core mechanic lets you create cut-out bubbles, which you can combine with similar bubble colors. That creates pockets where you can manipulate gravity, so that Rosvita can navigate through the game world and get to out-of-reach locations.

5) Rosvita01_1080

Planeter by Ditto (Sweden)

PLANETER is a vibrant exploration game in which you create the universe. Adventuring is difficult on your own, but along the way you will find some alien friends to help you. Wiggle and wobble your way across the colourful terrain to discover the secrets of each planet, helping them flourish. PLANETER’s soothing soundtrack accompanied me as I floated, in my little bubble, between worlds. When the bubble bursts, there are puzzles to solve that reveal the mysteries of the planets.

6) Planeter

Cerulean Moon by Nacho Beard (Spain)

Cerulean Moon puts a new spin on platformer controls. Instead of using virtual joysticks or thumb-sized buttons in the corner of the screen, the player holds a finger to the screen and gently slidea it left or right to ‘move’ the world around the character. The faster you move your finger, the faster the character dashes in that particular direction. The developer of the game, Nacho, demonstrated how this unique control style allows some high-precision movement, platform-dashing and fireball-dodging.

7) ceruleanMoon03

Cadence by Made With Monster Love (South Africa)

More than just a sound toy, the game is built on connections between logical nodes that create loops of music. Puzzles demand careful thought and can be solved in multiple ways, generating unique melodies from real-time synthesisers.

8) Cadence Editor Aug 2015 1600x900

Robot Space Labs by Robin Baumgarten (UK)

Robot Space Labs is a space exploration and asteroid mining game that is entirely centered around peaceful research with autonomous robots. Rather than controlling the robots directly, they’re fully autonomous and you manage them by planning the construction of new factories, excavate minerals, and research and upgrade technology in laboratories. Different missions, materials and environmental hazards such as radioactivity, solar winds and meteor collisions add challenge and diversity to the game.

9) Robot Space Labs

A Dog’s Heart by Wendelin Reich (France)

A Dog’s Heart is a short game featuring a unique, high-end artificial intelligence.  Mimi, a 5-month old puppy, is your companion on a magical island and you become friends while playing through various activities together.

10) dogsheart

Intergalactic Space Princess by Geeiz Games (Australia)

Intergalactic Space Princess is a hyperactive adventure game about mistaken identity and roaming across the galaxy. It’s like a TV episode where you get to do all the action. You play as a sassy 14 year old, Meline, who accidentally gets eaten by a giant space worm and transported to a new planet, where people think she’s the REAL Space Princess. Features minigames, rap battles, sticking googly eyes on tomatoes, falling down a worms stomach and more!

11) spaceprincess

Sunshine by Amy Dentata (USA)
Sunshine is a first-person exploration game set in a futuristic, low-poly city. Instead of a firearm or a melee-weapon, you posses a wrist-mounted computer-terminal that allows you to view live-feeds from nearby CCTV cameras and write commands to override nearby computer systems. This opens up a whole range of unique possibilities for missions across the neon city.

12) sunshine

Keyhole by Czarcade (USA)
Keyhole is a timeline exploration game where the player’s actions affect the future of the world and its inhabitants, and every action can be undone at any time. As the player travels back and forth along the timeline, items are moved from character to character, creating new branches of reality.
13) Keyhole

_PRISM by Clint Siu (USA)
Inspired by Fireproof Studios’ ‘The Room’ and Plato’s ‘Classical Elements’, PRISM is a puzzle game about interacting with glyphs that surround abstract 3D geometry. It’s up to the player to work out the relationship between different glyphs and how to align them. This series of ‘combination lock’ puzzles is beautifully presented, with both the visuals and the sound contributing to a really immersive experience.

14) Prism

The Last Word by Mark Backler (UK)

Mark Backler’s project adds an interesting spice to the traditional a-to-b 2D platformer genre. Each level is presented as excerpts of a diary. Words that present the narrative can be repositioned as platforms, re-aligned to create stairs or even re-located to cause an effect to a certain object blocking or hindering your player’s progress. Each level brings a new part of the story and new environmental puzzles.

15) Last Word ScreenshotInduction by Bryan Gale (UK)

Induction is a puzzle game about time travel and paradoxes. You control a cube moving around abstract isometric levels and solve puzzles by jumping back in time and co-operating with past versions of yourself. Adding to the difficulty, you’re always required to create a ‘consistent’ timeline before you can complete each puzzle, so you have to be careful not to do anything that prevents your past self going back in time.

16) induction-screenshot-5

Monologue

Monologue is a window into the world, work, and lives of the community members and developers that make up the Mono Project, which is a free cross-platform development environment used primarily on Linux.

If you would rather follow Monologue using a newsreader, we provide the following feed:

RSS 2.0 Feed

Monologue is powered by Mono and the Monologue software.

Bloggers