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.

May 21

DevOps with TeamCity

Previously, I explained how to implement a fully automated branch per task cycle with Bamboo to merge branches when certain conditions were met. Now, I will explain how to implement the same solution with TeamCity.

What I'm going to explain now is how to configure TeamCity to monitor Plastic SCM branches and directly merge them to main when certain conditions are met (when a certain value is assigned to an attribute or even certain status in the associated issue tracker).

In the example, I'm going to keep using Jira as issue tracker, but nothing prevents you from connect to any other issue tracking system.

Cycle described
Read more »

May 18

Startup Improvements in Xamarin.Forms on Android

With Xamarin.Forms 3.0 in addition to the many new feature work that we did, we have been doing some general optimizations across the board, from compile times to startup times and wanted to share some recent results on the net effect on one of our larger sample apps.

These are the results when doing a cold start for the SmartHotel360 application on Android when compiled for 32bits (armeabi-v7a) on a Google Pixel (1st gen).

Release Release/AOT Release/AOT+LLVM
Forms 2.5.0 6.59s 1.66s 1.61s
Forms 3.0.0 3.52s 1.41s 1.38s

This is independent of the work that we are doing to improve Android's startup speed, that both brings additional benefits today, and will bring additional benefits in the future.

One of the areas that we are investing on for Android is to remove any dynamic code execution at startup to integrate with the Java runtime, instead all of this is being statically computed, similar to what we are doing on Mac and iOS where we completely eliminated reflection and code generation from startup.

Faces of Unity: Andrew Maneri

Unity is made up of talented people, including artists, engineers, and project managers, whose work is as varied as their interests! Get to know who they are, what exciting projects they’re working on, and what drives them through the Faces of Unity Blog series. In our first post, we profiled Sarah Stumbo, a Producer on […]

May 16

Xamarin.Essentials: Cross-Platform APIs for Mobile Apps

When developing iOS and Android apps with Xamarin, developers can access every native platform API using C#. These bindings not only expose the platform APIs in C#, but add powerful C# features, such as async/await, events, delegates, and more. This is a huge advantage for developers, because they never have to leave C#, whether they’re writing shared business logic, user interface, or accessing native features. One key feature developers often look for when developing cross-platform apps with Xamarin is a way to access common native features from their shared code without having to write their own abstractions or find an open source plugin created by the community.

The dream of a single API to access features such as geolocation, sensors, secure storage, and more is now a reality for any application created with Xamarin with Xamarin.Essentials!

Xamarin.Essentials APIs

In our first preview, available today, Xamarin.Essentials APIs provide access to over 25 native features from a single cross-platform API library, which can be accessed from shared code no matter how the user interface is created. This means you can use Xamarin.Essentials APIs with a single Xamarin.Android app or a Xamarin.Forms app targeting iOS, Android, and UWP. Even though it’s packed with features, it’s still fully optimized for performance and minimal impact on app size, because the library takes full advantage of being linker safe. This means only the APIs and features you use will be included in your app and the rest will be removed when you compile your app.

The preview release, with the initial set of cross-platform APIs, can be installed in your apps through NuGet :

The initial set of APIs was based on feedback from Xamarin developers about what they wanted to see from a cross-platform API library. We will continue to add more over time.

Getting Started

It’s easy to start using Xamarin.Essentials APIs in any new or existing app in just a few easy steps:

  1. Open an existing project, or create a new project using the Blank App template under Visual Studio C# (Android, iPhone & iPad, or Cross-Platform).
  2. Add Xamarin.Essentials NuGet package to projects:
    1. Visual Studio: In the Solution Explorer panel, right click on the solution name and select Manage NuGet Packages. Search for Xamarin.Essentials and install the package into ALL projects including iOS, Android, UWP, and .NET Standard Libraries.
    2. Visual Studio for Mac: In the Solution Explorer panel, right click on the project name and select Add -> Add NuGet Packages…. Search for Xamarin.Essentials and install the package into ALL projects including iOS, Android, and .NET Standard Libraries.
  3. Add a reference to Xamarin.Essentials in any C# class to reference the APIs.

    using Xamarin.Essentials;

  4. Xamarin.Essentials requires small additional platform specific setup on Android projects to access specific features:

    Inside of the Android project’s MainLauncher or any Activity that is launched Xamarin.Essentials must be initialized in the OnCreate method:

    Xamarin.Essentials.Platform.Init(this, bundle);

    To handle runtime permissions on Android Xamarin.Essentials must receive any `OnRequestPermissionsResult`. Add the following code to all Activity classes:

    public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
    {
        Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
    
        base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
    }

That’s it! You’re now ready to start using Xamarin.Essentials APIs in your app. Each API has been fully documented with code snippets that you can copy into your app.

Be sure to read to read our full Getting Started guide for additional details.

Build a Compass

During one of my sessions at Microsoft Build 2018 I showed how to combine Xamarin.Forms and Xamarin.Essentials APIs to build a cross-platform Compass in under 10 minutes. It’s as simple as adding a few images for the compass into the application and a small amount of user interface:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>

    <Image HorizontalOptions="FillAndExpand"
           VerticalOptions="FillAndExpand"
           Source="compass.png"/>

    <Image HorizontalOptions="Center"
           VerticalOptions="Center"
           Source="arrow.png"
           x:Name="ImageArrow"/>

    <Label Grid.Row="1"
           x:Name="LabelInfo"
           VerticalOptions="Center" 
           HorizontalOptions="Center" />
</Grid>

I was able to use the Compass API from Xamarin.Essentials in the code behind for this page in order to register for events when the compass changed and update text of the label and the image’s rotation in just a few lines of code:

using Xamarin.Forms;
using Xamarin.Essentials;

namespace MyCompass
{
    public partial class MainPage : ContentPage
	{
		public MainPage()
		{
			InitializeComponent();

            // Register for reading changes
            Compass.ReadingChanged += Compass_ReadingChanged;
        }

        void Compass_ReadingChanged(CompassChangedEventArgs e)
        {
            LabelInfo.Text = $"Heading: {e.Reading.HeadingMagneticNorth}";
            ImageArrow.Rotation = e.Reading.HeadingMagneticNorth;
        }

        protected override void OnAppearing()
        {
            base.OnAppearing();
            Compass.Start(SensorSpeed.Ui);
        }

        protected override void OnDisappearing()
        {
            base.OnDisappearing();
            Compass.Stop();
        }
    }   
}

Just like that, a compass application is created! You can find the full source code and images on my GitHub.

What’s Next

Xamarin.Essentials has gone through rigorous testing, but we’re asking you to provide feedback during this short preview cycle. Please try out the library in your apps and report any issue that you may run into on the Xamarin.Essentials GitHub repository.

We see this library as a core fundamental piece of the Xamarin platform and know that it’s an essential building block for all developer and applications. As such, we will be integrating the Xamarin.Essentials NuGet package into every iOS, Android, and Xamarin.Forms template inside Visual Studio and Visual Studio for Mac, so developers have access to these APIs from the very beginning of their project.

See it Live

You can watch a full overview of Xamarin, Xamarin.Forms, and Xamarin.Essentials in my Building mobile apps with Visual Studio and Xamarin session from Microsoft Build 2018:

Xamarin University Guest Lecture

Join me on Thursday, June 7th 10:00 AM PST when I will host a LIVE guest lecture on Xamarin University covering all things Xamarin.Essentials in details and answering all questions. If you aren’t a Xamarin University subscriber simply sign up for a free account to get access to the guest lecture.

 

Register

 

Learn More

You can browse through our full documentation that has a full overview of how to get started and how to use each and every feature of Xamarin.Essentials. We have also provided full API reference that can be fully browsed online to dive into the details of Xamarin.Essentials APIs.

The post Xamarin.Essentials: Cross-Platform APIs for Mobile Apps appeared first on Xamarin Blog.

Debugging Pending changes view performance

Plastic finds changes super-fast. We expect Pending changes to refresh in under two seconds and three to four seconds for bigger projects that have more than 90,000 files in a workspace. Note: The first time that you open it, it will take longer because of some caching and disk monitoring setup.

If your Pending changes is not performing that fast, there is something wrong.

Back in release 6.0.16.960, we added a performance warning in Pending changes when it detects that finding changes is slow. The warning includes a link to the documentation with performance recommendations:

This blogpost explains how to troubleshoot beyond the basics for what might be slowing down your Pending changes view.

Read more »

Join the 2018.2 beta and earn the chance to win great Unity gear

The Unity 2018.2 beta is up and running, and as an added bonus to getting to mess around with all the new features, we’re continuing the tradition of our beta sweepstakes. If you haven’t already read the blog about what’s new in the Unity 2018.2 beta, you can find it right here. The latest beta […]

May 15

Integrating Xamarin.com into Microsoft Sites

Over the past year we’ve started to make it even easier to find Xamarin information on Microsoft sites, and going forward you will start seeing changes to xamarin.com as we continue to migrate content over to Microsoft properties. Below is a summary of where to find key information you might be looking for:
 
Content that has already moved:

 
Content that is staying where it is for now:

 
We recommend updating your bookmarks so you can continue to easily find what you need.

The post Integrating Xamarin.com into Microsoft Sites appeared first on Xamarin Blog.

May 14

Update Your Xamarin.Mac Apps for 64-bit Today!

Last June, Apple announced that upcoming macOS releases would only support 32-bit applications “with compromises”. If your Mac application is not 64-bit, we strongly recommend taking action to avoid compromises in the next version of macOS.

Migration to Modern Xamarin.Mac

The most noteworthy update includes migrating your project to 64-bit. Older projects that are still using Xamarin.Mac Classic or MonoMac will need to be migrated to Xamarin.Mac Unified to support 64-bit. Visual Studio for Mac includes a migration wizard that will help automate many of the mechanical changes that are needed to update your Mac application. First, review any build warnings. Existing warnings may be pointing towards future issues and should be fixed prior to migration. Next, start the Migration Wizard from the Project > Migrate to Xamarin.Mac Unified API menu. The menu will not be visible if your application has already been migrated to Xamarin.Mac Unified (references Xamarin.Mac.dll).

After the automated migration wizard has finished, build your project to determine if additional changes are required. There were a number of API corrections made in Unified, and changes to your code may be required. More information can be found in the migration documentation.

The Journey to 64-bit

Xamarin.Mac Unified projects have support for building 64-bit binaries, but some existing and migrated projects may be building 32-bit instead. To verify your project’s settings, open the Project > Options menu and navigate to the Mac Build > Supported architectures setting. Select the x86_64 setting for 64-bit builds.

Moving from 32-bit to 64-bit may uncover a number of issues in your application, as it changes the size and alignment of data structures. This can affect custom P/Invoke invocations and native code linked in your application. Review any build warnings and test your application thoroughly to catch potential issues after updating.

Learn More

For additional information, visit our documentation on enabling 64-bit in your Mac applications.

Discuss this post on the Xamarin forums

The post Update Your Xamarin.Mac Apps for 64-bit Today! appeared first on Xamarin Blog.

Stripping scriptable shader variants

Massively reduce Player build time and data size by allowing developers to control which Shader variants are handled by the Unity Shader compiler and included in the Player data. Player build time and data size increase along with the complexity of your project because of the rising number of shader variants. With scriptable shader variants […]

May 12

Oculus Launch Pad 2018 is here!

Get the help you need to develop and bring your VR experience to market. Apply until May 20! Since 2016, Oculus has invited promising developers from underrepresented backgrounds to get hands-on coaching that helps them meet their VR development goals by joining the Launch Pad program. Apply by May 20 to join this diverse range […]

May 11

Podcast: Build 2018 Recap for Mobile Developers

In this episode of the Xamarin Podcast, James Montemagno and I discuss the news for mobile developers from Build 2018, including Xamarin.Forms 3.0, Hyper-V support for the Android emulator, Xamarin.Essentials, and updates to Visual Studio 2017 and Visual Studio for Mac.

Be sure to download today’s episode from your favorite podcast app!



Subscribe or Download Today

Keeping up with the latest in .NET, C#, and Xamarin is easier than ever with the Xamarin Podcast! Cohosts Pierce Boggan and James Montemagno cover topics relevant to Xamarin developers, from designing mobile apps to identity management. Be sure to subscribe to the Xamarin Podcast on iTunes, Google Play Music, Stitcher, or your favorite podcast app you use to ensure you don’t miss an episode.

The post Podcast: Build 2018 Recap for Mobile Developers appeared first on Xamarin Blog.

Unity at Microsoft Build: 7 takeaways from the show

The Microsoft Build 2018 developer conference just wrapped up in Seattle and Unity was there to learn about key announcements, talk about mixed reality development, and (for the first time) demo how PiXYZ unlocks CAD data for real-time development. Here are the top 7 takeaways from Microsoft Build. 1) Take CAD to mixed reality with […]

May 10

Launching 3D Game Kit: Explore and Learn Unity in 3D

In February, Unity’s Content Team brought you The Explorer 2D Game Kit, a collection of mechanics, tools, systems and assets to hook up gameplay without writing any code. Now we’re bringing you the three-dimensional world of Ellen and her mission to explore the unknown alien landscape where her dropship has crash landed. The beautiful game […]

May 9

All Things Xamarin at Build 2018

Microsoft Build 2018 has finally arrived which means exciting news for developers about Microsoft products and technologies, including Xamarin. For those following along at home, we’ve rounded up all of our announcements below, highlighting all of the Xamarin news from Build that we are sure will delight developers in a single place.

Hyper-V Android Emulator Support

We announced a preview of the Google Android emulator that’s compatible with Hyper-V when running the Windows 10 April 2018 Update. Amazing work was done by the Windows Hyper-V team, with help from the Xamarin team, to make this happen. This enables developers to use Google’s hardware-accelerated Android emulator side-by-side with other Hyper-V based technologies, including Hyper-V VMs, Docker tooling, the HoloLens emulator, and more. Now, any Android developers on Windows can use a fast Android emulator that will always support the latest Android APIs and works with Google Play Services out-of-the-box.

For more information on configuring the Hyper-V emulator, and for a listing of known issues, visit our documentation.

Xamarin.Forms 3.0

We’re excited to release Xamarin.Forms 3.0 stable. This version brings new layout and styling power, with features such as Visual State Manager, Flex Layout, Style Sheets, and Right-to-Left support. It also includes several bug fixes and amazing community contributions, so be sure to check out the full release notes. Coupled with the fantastic improvements up and down the Xamarin stack, this is our fastest and richest release to date!

Visual Studio Tools for Xamarin

Xamarin.Forms XAML IntelliSense

Xamarin.Forms developers using Visual Studio 2017 version 15.7 will find a vastly improved IntelliSense experience. It’s now powered by the same IntelliSense engine from WPF and UWP bringing several enhancements including improved matching, binding/commanding completion, resource completion, markup extension completion. The engine also enhanced light bulb suggestions, code navigation, and linting.

Automatic iOS Device Provisioning

To continue making things as simple as possible for developers, we’re introducing automatic iOS device provisioning in Visual Studio 2017 version 15.7. This feature streamlines the experience of requesting a development certificate while generating a signing key, adding a device in the Developer Center and creating a provisioning profile, all from within Visual Studio.

Improved Android SDK Management

Figuring out what Android SDKs to install for development can take time, so we added a new Android SDK manager that takes the guesswork out of it. When you open an Android project that compiles against an SDK version you don’t have installed, a notice will appear to help you download and install the SDK in the background for you. This feature is off by default, but can easily be enabled by going to Tools > Options > Xamarin > Android Settings > Enable Auto Install Android SDKs.

Updated iOS & Android Project Templates

Project templates are an important part of the app building journey, so we have rebuilt and reorganized our native iOS and Android project templates to make them easier to find in the File -> New window. Templates were also added for new user experience patterns in Android, like flyout menu and bottom tabs so you can start building modern-day apps even quicker.

Platform Improvements

Xamarin.Android

We’re now distributing the Android Oreo SDK (Android API level 27), Android SDK Tools 26, and the Xamarin Android Device Manager in Visual Studio 2017 and Visual Studio for Mac. Additionally, in Visual Studio 2017 you’ll see reduced waiting time for your app appear on screen by deploying the Xamarin runtime to your device or emulator while your app compiles.

Xamarin.iOS

Our iOS, macOS, watchOS, and tvOS applications now feature a fully static type system, which results in the following benefits:

  • Smaller Applications: The linked Xamarin.iOS.dll is 30–50% smaller, since information (e.g. custom attributes) needed only at build time can be removed. This also allows the linker to remove more code than before since less code is being referenced.
  • Faster Application Startup: More registration work is done at build time instead of runtime. Removing the need to use (slow) reflection on custom attributes to register types and methods.
  • Reduced Memory Usage: With this work, we also reduced the memory required for applications. The initial (startup) memory requirement is down 30% for a minimal application and 20% for extensions, making it easier to create extensions where iOS imposes memory limits (for example, 16MB for Today extensions).

Update Today

Xamarin.Forms 3.0 is available now on NuGet. You can also get the Visual Studio 2017 version 15.7 update today via the notification hub in Visual Studio. Also be sure to download the Xamarin Android Device Manager for Android Oreo. Try them out, and don’t forget to continue sending us your feedback!

The post All Things Xamarin at Build 2018 appeared first on Xamarin Blog.

Unity Packages Life Cycle

By now, you’ve noticed a plan for Unity involving packages, which has been steadily moving forward. The story kicked off with the ProBuilder announcement, and we’ve since followed up by introducing features of the Package Manager and improved Unity Project Management. Now, let’s dive a little deeper into the story. Packages, what are they? Packages […]

May 8

Bringing the Indoor WRLD to Unity

Exploring WRLD outdoors is now available indoors! We’re excited to announce that WRLD has released a new version of the WRLD Unity SDK on the Asset Store! This update enables developers to customize their own 3D indoor maps for their projects in Unity. Build innovative “Digital Twin” experiences for buildings and their surrounding environments with […]

May 7

Try the Latest Release of Xamarin.Forms 3.0!

We are overjoyed to bring you our latest stable release of Xamarin.Forms, version 3.0. This is our fastest, richest release to date coupled with fantastic improvements up and down the Xamarin stack such as the latest XAML IntelliSense experience in Visual Studio 2017.

When you upgrade to 3.0 you’ll discover new layout and styling power that will improve how you build your UI including Visual State Manager, Flex Layout, Style Sheets, and Right-to-Left support just to name a few. In addition to micro-optimizations, XAML compilation has also received specific attention to show build times reduced by as much as 88% in some benchmarks.

Xamarin.Forms 3.0

Xamarin.Forms 3.0 also releases significant community contributions. This post contains a brief introduction to each feature and a list of valuable resources that will get you going quickly.

Visual State Manager

Visual State Manager is known and loved on other XAML platforms, and we’re thrilled to bring it to you in Xamarin.Forms 3.0. You can now define the various states for your layouts and controls declaratively in XAML or C# and easily update your UI. Here is a camera view that handles both portrait and landscape orientations:

To change where the capture button, the close button, and the last image button appear depending on that orientation change, use the Visual State Manager. First, define your states in your page resources:

<ContentPage.Resources>
    <Style TargetType="FlexLayout">
        <Setter Property="VisualStateManager.VisualStateGroups">
            <VisualStateGroupList x:Name="CommonStates">
                <VisualStateGroup>
                    <VisualState x:Name="Portrait">
                        <VisualState.Setters>
                            <Setter Property="Direction" Value="Column"/>
                            <Setter Property="Margin">
                                <OnPlatform x:TypeArguments="Thickness" Default="0">
                                    <On Platform="iOS" Value="0,30"/>
                                </OnPlatform>
                            </Setter>
                        </VisualState.Setters>
                    </VisualState>
                    <VisualState x:Name="Horizontal">
                        <VisualState.Setters>
                            <Setter Property="Direction" Value="Row"/>
                            <Setter Property="Margin">
                                <OnPlatform x:TypeArguments="Thickness" Default="0">
                                    <On Platform="iOS" Value="30,0"/>
                                </OnPlatform>
                            </Setter>
                        </VisualState.Setters>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateGroupList>
        </Setter>
    </Style>
    <Style TargetType="Image">
        <Setter Property="VisualStateManager.VisualStateGroups">
            <VisualStateGroupList x:Name="CommonStates">
                <VisualStateGroup>
                    <VisualState x:Name="Portrait">
                        <VisualState.Setters>
                            <Setter Property="AbsoluteLayout.LayoutBounds" 
                                    Value="30, 0.5, 40, 40"/>
                            <Setter Property="AbsoluteLayout.LayoutFlags" 
                                    Value="YProportional"/>
                        </VisualState.Setters>
                    </VisualState>
                    <VisualState x:Name="Horizontal">
                        <VisualState.Setters>
                            <Setter Property="AbsoluteLayout.LayoutBounds" 
                                    Value="0.5, 0.9, 40, 40"/>
                            <Setter Property="AbsoluteLayout.LayoutFlags" 
                                    Value="PositionProportional"/>
                        </VisualState.Setters>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateGroupList>
        </Setter>
    </Style>
</ContentPage.Resources>

There are two groups; one for each control that needs to be updated, for simplicity they share the same state names. To change the state in the page’s C# file, call using the following:

VisualStateManager.GoToState(Container, (width > height) ? "Horizontal" : "Portrait");
VisualStateManager.GoToState(LastImage, (width > height) ? "Horizontal" : "Portrait");

Some calculation may be required in order to determine the orientation and target that state.

For more information about how you can make the most of Visual State Manager in Xamarin.Forms:

FlexLayout

FlexLayout is a new layout inspired by the web’s Flexbox. Just as browsers can be any size, the variety of screen dimensions that your Xamarin.Forms apps can run on has grown significantly. FlexLayout promotes flat, performant, and flexible UIs. FlexLayout is ideal for handling distribution and spacing of content within your layouts. It also provides you control of the direction of your layout, the justification, and alignment among other properties.

Start using FlexLayout today by exploring these brand new resources:

StyleSheets

Cascading Style Sheets (CSS) is a natural companion to FlexLayout given their shared heritage. Using CSS to style your layouts is an optimal way to express styles in tandem with XAML. We know many of you love CSS from your experience with web technologies and we also recognize XAML developers love to express their styles in XAML. We are so excited to bring both of these productivity options to you! Use what makes you most productive.

StyleSheets can be added as separate CSS files in your project, or inline in your Resources. A variety of common selectors are available to compose your styles.

For more information about styling your FlexLayouts and the rest of your application with CSS:

Right-To-Left Localization

When supporting languages such as Arabic and Hebrew that flow right-to-left, you may now tap into the very easy to use FlowDirection property on any VisualElement instead of using platform-specifics or effects as you may have used previously. Because you already know the direction the device prefers by accessing Device.FlowDirection, updating your UI could be as easy as adding this to the head of your page in XAML:

FlowDirection="{x:Static Device.FlowDirection}"

For more information about updating your applications to support right-to-left layouts:

Community Contributions

Xamarin.Forms 3.0 also boasts some significant contributions from our devoted community, including the “F100” collaboration to fill in the gaps and deserve to be supported in Xamarin.Forms. The code-name stands for a challenge to improve 100 little things in Xamarin.Forms. Follow along and please contribute on the GitHub project board!

Possibly the most celebrated contribution making this preview debut is the WPF backend for Xamarin.Forms. This allows you to bring Xamarin.Forms UI into existing WPF applications via Native Forms, as well as building your Xamarin.Forms applications for older versions of Windows. For additional information about this new backend check out:

Update Today and Start Exploring!

Xamarin.Forms 3.0 is now available on NuGet. Be sure to read the full release notes which includes a ton of bug fixes.

Fork the Conference Camera prototype app that demonstrates all of these amazing features, and includes some nice Custom Vision integration as a bonus from Azure Cognitive Services!

Enjoy this post? Discuss it on the Xamarin Forums!

The post Try the Latest Release of Xamarin.Forms 3.0! appeared first on Xamarin Blog.

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