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.

October 19

webadmin – introducing the new server admin tool

We have just released a new cross-platform (web-based) admin tool to configure and monitor the Plastic SCM server. We call it webadmin and it is included in release

Upcoming Webinar | Build Better Games with Unity and Microsoft Azure

Register now to join David Antognoli on Thursday, November 7 at 9 am PT to learn how to take your Unity games to the next level with powerful cloud services. He’ll walk through how to connect your apps to Microsoft Azure, adding compelling features that users love, like leaderboards and heatmaps, and demo how new Unity and Visual Studio 2017 features improve your development process and your users’ experience.

In the session, you will:

  • Create and configure a new Unity project and integrate with Azure Easy tables from scratch.
  • Reference external packages from NuGet in Unity projects.
  • Update the Unity Mono security certificate store.
  • Add leaderboards and use the Azure Mobile Client SDK to save data telemetry.
  • Analyze heatmap telemetry to improve your game design.
  • Ask questions and receive guidance from our team of experts.



We encourage all registrants to attend the webinar live, as we will be answering questions throughout the event. However, all registrants will receive a link to the recording, so please feel free to sign up even if you cannot join us that day.

The post Upcoming Webinar | Build Better Games with Unity and Microsoft Azure appeared first on Xamarin Blog.

October 18

Plugin and Permission Changes with iOS 11

iOS 11 introduced some fun updates around permissions when accessing certain features on the device. I first noticed these changes when trying to access a user location with the Geolocator Plugin in a Xamarin.Forms application. To my surprise, nothing happened. Upon further investigation of the application’s Output, I noticed a message explaining exactly what I missed!

This app has attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain both NSLocationAlwaysAndWhenInUseUsageDescription and NSLocationWhenInUseUsageDescription keys with stringvalues explaining to the user how the app uses this data.

What does that mean for your applications and how does it relate to any Plugins you might be using? This post explains what I’ve discovered while using two very common Plugins, Xam.Plugin.Geolocator and Xam.Plugin.Media.

Changes to Location Permissions

Developers are required to include both NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription in their info.plist file with iOS 11. Most developers will want to support earlier versions of iOS as well, which means you’ll need to also include a third key, NSLocationAlwaysUsageDescription. The NSLocationAlwaysAndWhenInUsageDescription key is new for iOS 11 and helps developers with a new recommended approach for requesting permissions. Apple recommends that applications first request permission for location usage with the When in Use access level. Then, after some time during which trust is gained, the application can more confidently request the Always level of access. It’s important to note that apps can only request the Always level once.

Here’s what the relevant part of the updated info.plist file looks like using the Geolocator sample application:

<string>Need location for geolocator plugin.</string>

<string>Need location for geolocator plugin.</string>

<string>Need location for geolocator plugin.</string>

Changes to Photo Permissions

There was a single key, NSPhotoLibraryUsageDescription, needed in the info.plist in previous versions of iOS for accessing the user’s Photo Library. iOS 11 added a new key to separate Write-only access from Read access. The new NSPhotoLibraryAddUsageDescription key is required if your app needs to save images to the Photo Library while the old NSPhotoLibraryUsageDescription key is required for reading an image from the Photo Library.

Update Your Xamarin Plugins

The Xamarin Plugins have been very popular in the community ever since they were announced. The Geolocator, Media and Permissions plugins are ready for your apps and iOS 11. If your not familiar with Plugins, be sure to check out the guide in the Xamarin Developer Center where you can learn more about which ones are available and how to create them.

Discuss this post on the forums.

The post Plugin and Permission Changes with iOS 11 appeared first on Xamarin Blog.

October 16

Adaptive UI with Xamarin.Forms

Xamarin.Forms has supported iOS, Android, and Windows for a long time. We’ve also added new platforms to keep up with the changing landscape, such as Tizen and macOS, with Linux and Windows WPF on the horizon. These platforms run on a wide variety of devices including phones, tablets, desktops, and TVs. This presents an interesting challenge for us as developers; how do we design a UI that intelligently scales and makes sense on each idiom it’s presented on?

Respond to Screen Size

By default, Xamarin.Forms Layouts and Controls are designed to be responsive and will often grow and shrink to take advantage of the available screen space. If more control is needed, the Xamarin.Forms Page class has a SizeChanged event we can use to determine the available screen-size at runtime. This event is raised when the Page is displayed, allowing us to adjust or change our Page’s UI based on the Width or Height of the screen.

public partial class MainPage : ContentPage
   public MainPage()
      SizeChanged += MainPageSizeChanged;

   void MainPageSizeChanged(object sender, EventArgs e)
      imgMonkey.WidthRequest = Math.Min(this.Width, 400);

Respond to Orientation

We can use the SizeChanged event to respond to orientation changes. SizeChanged will be raised when the screen is rotated. We can determine the orientation by comparing the Page’s Width and Height properties.


public partial MainPage : ContentPage
    public MainPage()
        SizeChanged += MainPageSizeChanged;

    void MainPageSizeChanged(object sender, EventArgs e)
        bool isPortrait = this.Height &gt; this.Width;
        stackPanel.Orientation = (isPortrait ? StackOrientation.Horizontal : StackOrientation.Vertical);

Portrait and Landscape Orientations

Respond to Device Type

We often think about responsive and adaptive in terms of screen size, but we also need to respond to how the user interacts with the device. For instance, we use touch on mobile devices, and a mouse with a keyboard on a desktop PC.
Xamarin.Forms provides a static Idiom property on the Device class that we can use to check the device type. Devices are sorted into four categories: Phone, Tablet, Desktop, and TV.

switch (Device.Idiom)
    case TargetIdiom.Desktop:
    case TargetIdiom.Phone:
    case TargetIdiom.Tablet:
    case TargetIdiom.TV:


We can use Device.Idiom to change the UI we present. We have several options you can use depending on a number of changes you need to make.

For small changes, like adjusting button sizes, we update the controls and layouts directly.

if (Device.Idiom == TargetIdiom.Desktop)
    buttonAbout.HeightRequest = 25;
    buttonAbout.WidthRequest = 40;
    buttonAbout.HeightRequest = 40;
    buttonAbout.WidthRequest = 70;

When you need to add or remove portions of your UI, Xamarin.Forms provides a ContentView which allows us to create composite controls. We define portions of reusable UI with behavior, and then decide which composite controls to display based on the Idiom. You can think of a ContentView as a partial Xamarin.Forms Page.

void AddColorPicker ()
    IMyColorPicker colorPicker;

    if (Device.Idiom == TargetIdiom.Desktop)
        colorPicker = new ColorPickerMouseView();
        colorPicker = new ColorPickerTouchView();

    colorPicker.VerticalOptions = LayoutOptions.Start;
    colorPicker.ColorChanged += ColorPickerColorChanged;



When your UI changes are significant between device types, you can create multiple pages. We use Device.Idiom to decide which page to display or you can even use ContentViews within these pages to avoid duplicate code.

And If you’re using MVVM, you can define a single View Model that is used for each version of your Page, further reducing repeated code!

ContentPage page;

if(Device.Idiom == TargetIdiom.Desktop)
    page = new DetailsDesktopPage(new MyDetailViewModel(...));
else if(Device.Idiom == TargetIdiom.TV)
    page = new DetailsTVPage(new MyDetailViewModel(...));
else //Phone or Tablet
    page = new DetailsMobilePage(new MyDetailViewModel(...));



If you want to learn more about adaptive design, you can find excellent documentation here and here.

Head to the Xamarin University website for more great Xamarin training, including free Self-Guided courses!

Discuss this post on the forums.

The post Adaptive UI with Xamarin.Forms appeared first on Xamarin Blog.

October 13

Give the Visual Studio 2017 Version 15.5 Preview a Try!

With Visual Studio 2017 version 15.4 now stable and sporting some awesome new features, such as Xamarin Live integration, Android Oreo / iOS 11 support, and a smarter, smaller installation, it’s time to turn our attention to the next version of Visual Studio 2017, version 15.5! This upcoming release is now available as a preview which, like all Visual Studio previews, is a separate and sandboxed installation than your stable one. This means it’s completely safe to try without risking your production development environment.

In this blog post we will take a look at some of our favorite new features landing in the Visual Studio 2017 version 15.5 previews. Be sure to give the release a try and let us know how it works for you and your team!

Xamarin Live

Xamarin Live enables developers to continuously deploy, test, and debug their apps directly on iOS and Android devices. After downloading the Xamarin Live Player app from the App Store or Google Play, you can pair your device with Visual Studio and revolutionize the way you build your next app. And with the “Live Run” functionality, you also get a real-time preview of your XAML as you type! In this release we’re adding more integration for Xamarin Live with Visual Studio and enhancements to the Live Run functionality to make building XAML UIs natural and productive.

Live XAML Previewing

We know that developers are looking for easy ways to preview XAML and cut down on long debug-deploy-test cycles. The “Live Run” functionality allows you to preview changes to your XAML in real-time on a device as you type. Once you have entered a live run mode, Visual Studio will automatically re-deploy your XAML whenever the active document changes and render the entire context of the page, including the binding context and the codebehind! There is also a new context menu option (Tools > Xamarin Live Player > Live Run Current View ) and keyboard shortcut to make live running XAML fast and easy.

Check out the improved workflow for Debug and Live Run in Visual Studio 2017 version 15.5 below:


Deeper Integration with Visual Studio

Live Player devices act and feel just like regular emulator and device debug targets. Xamarin Live already supports breakpoints when debugging, and in this release we improved how the overall functionality integrates into Visual Studio. For example, it will now warn you when you attempt to perform an unsupported operation, such as live running an iOS app on an Android device, and suggest actions to resolve the issue. We’ve added a visual indication of the deployment status operation in the status bar as well so you know exactly where the deployment operation stands.

Finally, we’ve integrated Xamarin Live with the Console and Error windows in Visual Studio. If you log any output in your app (such as Console.WriteLine), it will now show in the console output while deployment errors will be surfaced in the Visual Studio Error window.

New Mac Connection Workflow

If you have ever built an iOS app with Xamarin on Windows then you know you must connect to a Mac in order to perform builds. So in this release we have added new functionality that improves the connection workflow so you can start building iOS apps in Visual Studio even faster.

Connection Status Indicator

You should always know the exact status of a connection attempt to the Mac, however previously the only way to know the status was to check for a “lock” icon in the Xamarin Mac Agent or a green icon in the Visual Studio toolbar. This didn’t provide any granularity to the status of a connection attempt so we’ve added a new UI for viewing the connection progress that provides more detail:

New connection workflow for the Xamarin Mac Agent.

Much, much, more!

These are only a few of the new features in Visual Studio 2017 version 15.5. This release contains so much more, including updated Xamarin SDKs for iOS and Android, lots of bug fixes, the integration of the Xamarin Android SDK Manager into the install, and improvements to our extension for accessibility and localization.

To get started with the previews today, download the Visual Studio Preview installer and select the Mobile .NET (Xamarin) workload just as you did for your stable installation. Remember, Visual Studio previews are installed side-by-side your current installation and are sandboxed from your production development environment.

If you decide you no longer want to use the preview, simply use the Visual Studio Installer to uninstall any preview instance. While your stable installation should not be affected by doing this, we do recommend running a “Repair” on your other installation afterwards as a precaution.

There’s so many reasons to try Visual Studio 2017 version 15.5, so give it a try and let us know what you think via Help -> Report a Problem in Visual Studio, on Developer Community, or reach out to me directly on Twitter.

The post Give the Visual Studio 2017 Version 15.5 Preview a Try! appeared first on Xamarin Blog.

October 12

Bring 3D Models To Life in Augmented Reality with UrhoSharp

UrhoSharp brings 3D to a variety of platforms and uses its own binary mdl format for model files. There are many sources for 3D models, including cgtrader and TurboSquid, and formats such as FBX, OBJ, DAE and BLEND. Urho3D provides tools like AssetImporter and the Urho3D Blender Add-in so you can use these models. In this post, we’ll look at these tools more closely and explain how to easily integrate them into your apps.

Importing 3D Assets with the Urho3D Blender Add-in

Since we’re building an ARKit application, and interior design is a fitting use case for AR, I’ve found a furniture model for this example.

Note* This post assumes some knowledge of the 3D Modeling software, Blender. If you’re not familiar with this tool and would like a primer, check out the tutorials section

In order to do this, find the Urho3D Exporter configuration panel located in the Properties panel:

To export a prefab, select the following options:

  1. Choose a location to save via the Output folder.
  2. Objects – All. To select specific objects in the Outliner, choose Only Selected.
  3. Export Geometries, Materials, and Textures.
  4. Export Urho Prefabs and check One Collective.
  5. Optionally, to interact with the object, add Physics (collision shapes, rigid bodies).

Click the magic Export button and go to the output directory, which will look like this:

Our prefab consists of several folders and files:

  1. Materials: Tell shaders which textures, techniques, and parameters to use.
  2. Models: Custom binary files representing 3D geometries.
  3. Objects: An XML file describing our prefab as a set of nodes, transforms, models, and materials.
  4. Textures: Diffuse maps, normal maps, specular maps, etc.

Import 3D Assets Using AssetImporter

Unlike the Urho3D Blender Add-in, AssetImporter is a command line interface (CLI) tool (based on Assimp). You can find the executable file in the UrhoSharp.Tools package. In order to convert an FBX file into a prefab, simply execute it with the following parameters:

AssetImporter.exe node file.fbx prefab.xml

To quickly review the results, there’s also a small WPF/Cocoa application over the AssetImporter CLI which can be found on GitHub. Now, simply add these files to your project and set the correct Build Action; for iOS it’s BundleResource:

Defining a Scene

The easiest way to define a scene is to subclass SimpleApplication, which contains a preconfigured scene with lights, cameras, and other components that you won’t need to create yourself.

public class UrhoApp: SimpleApplication
    public UrhoApp(ApplicationOptions opts) : base(opts) { }

    protected override unsafe void Start()

        var bookshelfNode = Scene.InstantiateXml(
            source: ResourceCache.GetFile("Objects/Scene.xml"),
            position: new Vector3(x: 0, y: -1f, z:1f),
            rotation: new Quaternion(90, 0, -90));

Scene.InstantiateXml will create a copy of the prefab defined in the assets with a given position, i.e. one meter away, one meter down.

Launching this Scene

Simply add a UrhoSurface (UIPanel) anywhere in your iOS app’s layout. As a root view, for example:

var surface = new UrhoSurface(UIScreen.MainScreen.Bounds);
surface.Show(new ApplicationOptions {
    ResourcePaths = new [] { "BookshelfData"}

This also shows how easily you can embed Urho into any existing UIKIt app as a (sub)view.

Combine it all with ARKit

In order to show the model in Augmented Reality powered by ARKit:

  1. Add the ARKit-specific assets (such as YCbCr shader, etc.).
  2. Then add the base Arkit Application class, described in the Using ARKit with UrhoSharp
  3. guide.

  4. And subclass the ArkitApp class instead of SimpleApplication.
  5. Run!

Bookshelf showing with ARKit

ArkitApp will be available with the UrhoSharp NuGet package in the near future and will also support Google ARCore so you will be able to play with UrhoSharp and AR on Android devices as well. The final demo is available on my GitHub. Assets are not included due to the license.

If you would like to learn more about UrhoSharp, make sure to visit the documentation in the Xamarin Developer Center!

Discuss this post on the forums.

The post Bring 3D Models To Life in Augmented Reality with UrhoSharp appeared first on Xamarin Blog.

October 11

Updating Xamarin.iOS Apps for the iPhone X

There’s no doubt that one of the biggest announcements from Apple this year was the iPhone X. The new Super Retina display is edge-to-edge on the device, creating an immersive experience we had yet to see on iPhones. With the new screen changes on the iPhone X, developers may be asking themselves, “What do I have to do update my app?” Let’s take a look at how you can start getting your app ready for the iPhone X.

Explore Your App With the iPhone X Simulator

The first step in testing if your app is ready for the iPhone X is to update your Xamarin.iOS version to 11+ and download and install Xcode 9. If you haven’t already done that, check out the documentation on getting started with iOS 11. Once the tooling is updated, you’ll be able to launch your app in the new iPhone X simulator and start exploring how your app behaves.

Pay particular attention to areas of your application that are not using Auto Layout or present content that is full screen. If your application supports landscape, remember to rotate the simulator and check that the UI still looks great in that orientation as well. If your application launches on the iPhone X and doesn’t take on the full resolution of the device, the most common reason for that is a missing Launch Screen Storyboard. You can review the documentation for more information on getting that set up.

iOS Designer showing label on iPhone X Simulator

Keep Your Layouts Safe

There may not be many updates needed for the iPhone X if you’re already using Auto Layout for your UI, since UIKit and Auto Layout will do most of the heavy lifting for you. However, you might find some constraints or manual layout techniques that need to be adjusted. iOS 11 introduced a new layout guide named SafeAreaLayoutGuide to help with these scenarios. The SafeAreaLayoutGuide allows you to constrain view positions to an area of the screen that is safe for all iPhones. Using this will help make sure that content isn’t clipped by the rounded device corners, home indicator, or the sensor housing.

To start using the SafeAreaLayoutGuide with the iOS Designer, make sure to enable it via your Storyboard properties. To do this:

  1. Click in an empty area of your Storyboard.
  2. Select the Properties panel in Visual Studio to see the setting.
  3. Create a constraint with Auto Layout. You will see dashed green lines indicating the safe area.

Checkbox for safe area

Updating Apps UI Display on iPhone X

Pay attention to areas of your app UI that are full screen and make sure they don’t get clipped or hidden behind the home indicator. If you’re working with a Xamarin.Forms-based project, be sure to stay tuned for a future release to help make updating your cross-platform UI code compatible with the iPhone X.

There are also some great resources available from Apple on updating for the iPhone X, with plenty of videos and guides on common pitfalls. If you’re still catching up on iOS 11, be sure to check out our introduction to iOS 11 documentation for all of the details on what’s new, as well as more information on updating your apps for iOS 11.

Discuss this post in the Xamarin Forums

The post Updating Xamarin.iOS Apps for the iPhone X appeared first on Xamarin Blog.

October 10

Build and Release Five-Star Apps Faster

The first step in the life of a mobile app is build automation, which builds the app and runs required tests to make sure the app follows required rules. Build automation is also the first step towards shipping high quality, five-star mobile apps. When building iOS and Android mobile applications, one of the main challenges is getting all the required tools and SDKs installed properly to successfully build the app and run the tests.

Imagine having a build machine that would build your Xamarin mobile apps irrespective of the platform, version, development technology, or form-factor targeted. Then, imagine running tests on that build using hundreds of unique, physical devices. Visual Studio Mobile Center does just that, allowing you to set up a virtual machine for build automation.

Visual Studio Mobile Center lets you collaborate on different steps in your mobile app’s lifecycle, be it build, test, distribute, analyze, or finding app crashes after the app is already in app stores. Here are a few of the features in Visual Studio Mobile Center that give you this functionality:

  • Create organization: Collaborate with colleagues or guests to manage different tasks in your app’s lifecycle. Members of the organization can have different roles and permissions, such as administrator or collaborator.
  • Support for code-repositories: Visual Studio Mobile Center can pull code hosted in Visual Studio Team Services, GitHub, or BitBucket.
  • Signing builds: Upload your certificates to sign the builds, so they can be tested and distributed automatically after every push.
  • Test Automation: Using different frameworks, builds can be automatically be tested on multiple physical devices.

For the animation shown in this blog post, I used the TranslateIT app, a Xamarin.Forms app that uses Microsoft Cognitive Services for text translation. The code repository for this app is stored on Visual Studio Team Services. The app with code is available on GitHub

The post Build and Release Five-Star Apps Faster appeared first on Xamarin Blog.

October 9

Developing Real-Time Communication Apps with WebSocket

WebSockets is a two-way communication protocol, or persistence communication channel over TCP connection, an extremely powerful protocol leveraged by numerous games, apps with chat functionality, and real-time apps such as stock tickers.

In this blog post, we’ll discuss how to build a simple Xamarin chat room application that will leverage and connect to an ASP.NET Core WebSocket service.

Getting Started

  1. Download the server source code from GitHub here.
  2. Install dotnet core 2.0 on your machine to run the server. Find the instructions here.
  3. Run dotnet run in the terminal once you’re in the source directory.
  4. Visit http://locahosthost:5000 or http://(IP/Hostname):5000, and make sure you see Easy chat service message on the web page.

Building the Mobile Client

Let’s start with creating a blank Xamarin.Forms app leveraging a shared project (a .NET Standard library could also be used) and call it EasyChat. We’ll use the System.Net.WebSockets.Client NuGet package in our mobile apps to communicate with the server.

Once the project is created, we can use the MainPage.xaml as a simple sign in page from which we’ll navigate to the chat room.

Next, we can add a new page for the chat room, ChatPage.xaml, and a very simple View Model called ChatPageViewModel.cs to handle WebSocket’s client-side code. Here in this view model, we have code to connect to the server and send and receive messages.

Connecting to a Socket

Using the System.Net.WebSockets.ClietWebSocket object to establish the connection, this object will be used subsequently to communicate with the server

var client = new ClientWebSocket();
async void ConnectToServerAsync() 
    await client.ConnectAsync(new Uri("ws://"), cts.Token);

    await Task.Factory.StartNew(async () =&gt; 
        while (true) 
            await ReadMessage();
    }, cts.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default);

Notice I’m using the IP address to connect to the server with the ConnectAsync method. This is the default host IP on the Android emulator, and we cannot use localhost or the default localhost IP.

iOS simulator running on Mac does allow us to use localhost, but when running on an iOS/Android device we must use hostname/IP address.

Reading Messages

Once a connection is open with the server, we can start monitoring for the incoming messages using the ReceiveAsync method. In this scenario, the messages are UTF8 encoded byte array; when we receive the message we have to convert bytes into readable string and ignore anything that is not text

async Task ReadMessage() 
    WebSocketReceiveResult result;
    var message = new ArraySegment(new byte[4096]);
        result = await client.ReceiveAsync(message, cts.Token);
        if (result.MessageType != WebSocketMessageType.Text)
        var messageBytes = message.Skip(message.Offset).Take(result.Count).ToArray();
        string receivedMessage = Encoding.UTF8.GetString(messageBytes);
        Console.WriteLine("Received: {0}", receivedMessage);
    while (!result.EndOfMessage);


Sending Messages

To send a message, we first need to convert the text to a byte array (using UTF8 encoding) and call the SendAsync method. Additionally, SendAsync requires parameters to identify the message type, and if it is the end of the message.

async void SendMessageAsync(string message) 
    if (!CanSendMessage(message))

    var byteMessage = Encoding.UTF8.GetBytes(message);
    var segmnet = new ArraySegment(byteMessage);

    await client.SendAsync(segmnet, WebSocketMessageType.Text, true, cts.Token);


Wrapping Up

In this post, we reviewed the necessary code to connect, receive, and send messages in real-time using Web Sockets in Xamarin apps. You can explore more about the available APIs on MSDN and download the completed sample Xamarin.Forms application on GitHub.

Discuss this post on the forums.

The post Developing Real-Time Communication Apps with WebSocket appeared first on Xamarin Blog.


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.