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.

December 12

Updates to the Xamarin iOS Designer

The Xamarin Designer for iOS is a visual designer that allows you to edit Storyboard and Xib files directly in Visual Studio and Visual Studio for Mac. Crafting your UI with a designer instead of completely in code is a topic of passionate debate, but it’s a lot of fun to visually design a user interface, especially on a favored platform such as iOS. With the latest 15.5.1 release available now, we’d like to share some of the changes that were made to the Xamarin Designer for iOS and highlight the major updates to help get you familiar with them.

Device, Adaptation, Orientation, and Zoom

An exciting change in this release is a new toolbar located at the bottom of the designer. This new toolbar is the place to find support for managing trait variations, zoom, and orientation. You’ll also find support for the latest devices here. With this new toolbar, it’s now easy and fast to switch between different devices, orientations, and sizes while working on designing your app.

Constraints vs. Frame Editing Mode

In previous versions, clicking on a view would toggle between being able to edit the position and size of a control to editing any constraints. Based on user feedback, we’ve integrated the ability to switch between these two modes by using the new Frame Editing Mode and Constraints Editing Mode toggle switch in the upper-right corner of the designer. You’ll find another button next to these that updates frames or constraints depending on which toggle is selected. To improve this experience further, we’re adding keybindings for these controls in a future release so that it’s even easier to switch between editing frames and adding constraints.

Wrapping Up

With the new toggle button for editing modes, you can quickly move between shifting a control around and adding constraints for the perfect and responsive layout. The next time you have a chance to use a designer for UI, give it a try! If you’re ready to check it out now and are looking for a place to start, head over to the iOS Designer Basics documentation.

Discuss this post on the Xamarin Forums

The post Updates to the Xamarin iOS Designer appeared first on Xamarin Blog.

December 11

Introduction to tvOS

Recently, Apple announced the AppleTV 4K, an improved version of the AppleTV launched in 2015, which brought us a new platform to develop for in tvOS. With the touch-enabled Siri remote, we have a new way to interact with apps on the big screen which is different, but not entirely unfamiliar. Having a device like this in the living room is a great way to bring people together and offers a unique stage for your apps.

From a developer’s perspective, tvOS presents many similarities to iOS (which it is built on), such as using UIKit and many other common iOS frameworks. This, alongside sharing common code with Xamarin, means that creating incredible apps for the big screen has never been easier!

tvOS Background

As developers, we may already be used to working with frameworks such as UIKit to create user interfaces for mobile devices. However, there’s one key difference in tvOS that needs to be considered: the user does not directly touch your interface. This key departure from most iOS counterparts means we should be careful and create easy to use interfaces that work on a large traditional TV screen. The main method of interaction is the touchpad on the AppleTV Remote, so the placement of your controls should be logical and have some kind of consistency, rather than just being placed randomly all over the screen. It should be simple to navigate by swiping on the Remote in the appropriate direction to get to the next control. To learn more about the Focus Engine built in to tvOS, we have a complete set of tvOS documentation.

We generally use storyboards when creating user interfaces for tvOS, the same as we would on iOS. Using storyboards is a great way to create interfaces quickly and easily, and the whole process is similar to creating an iOS app. Apps can also be created using TVML (markup language which is downloaded from a server at runtime), but this will be covered in a future blog post.

Getting Started with tvOS

Let’s get started with a simple tvOS project using Xamarin. For this tutorial, make sure you’re fully up to date with Visual Studio for Mac and Xcode:

File -> New Solution -> tvOS -> Single View App

Set the app name and identifier to anything you want (in this example it’s SimpleQuiz) and the Target to “tvOS 11.0”.

We can run this single view app in the tvOS simulator right away. You’ll notice that where you usually see the iPhone simulators, there are now simulators for the AppleTV 4K and the original AppleTV. For the sake of app development, the differences between the two models are fairly minimal, with the AppleTV 4K being slightly more powerful and able to display 4K content. The sizing of the interface remains consistent across all models.

You’ll be presented with a blank view when running the app, which means the basic single view app was built and deployed successfully! To navigate in the AppleTV simulator, you can use a simulated remote by going to Hardware -> Show AppleTV Remote, or you can use the arrow keys and the “enter” key on your keyboard.

A blank app is great to see that we can deploy successfully, but ultimately not very useful, so let’s create an interface. Building the user interface is simple thanks to storyboards and the Xamarin designer built into Visual Studio. When opening Main.storyboard, you’ll be presented with the blank view seen at runtime. The way we use the tvOS designer is exactly the same as the iOS designer; simply drag and drop the controls from the toolbox. Note that you don’t need to worry about size classes or the UI supporting rotation, as we’re not working with mobile devices.

Your First tvOS App

Let’s create a simple quiz app, which will allow us to explore creating a basic app with standard UIKit controls and add controls to the storyboard. Start by creating the interface below, with a label and four buttons. Give each button a sensible name (in this case Answer1, Answer2, etc.).

We now need to add some functionality to our app. Our interface has four buttons with a choice of four answers, but only one is correct. Our simple quiz app will display an alert when the user chooses an answer and show them whether their choice was correct or not.

Start with basic code for displaying whether the user chose the correct answer or not. Add the following method to ViewControllers.cs:

private void Answer(bool Correct)
{
    // Same UIAlertController we use in iOS!
    UIAlertController AnswerAlertController;
    if ( Correct )
    {
        AnswerAlertController = UIAlertController.Create("Correct Answer!", "You win!", UIAlertControllerStyle.Alert);
    }
    else
    {
        AnswerAlertController = UIAlertController.Create("Wrong Answer!", "Please try again", UIAlertControllerStyle.Alert);
    }
    AnswerAlertController.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
    PresentViewController(AnswerAlertController, true, null);
}


Notice that we’re using UIAlertController in exactly the same way as we would on iOS. This is what makes tvOS easy to work with, even if you’ve never created an app for it before. The system handles the presentation for us, and we don’t need to concern ourselves with any of the specifics.

Now we need to add some code behind our buttons. To do this, we can simply double click on a button to automatically add a method for the event from the view controller code. Do this for all four buttons and within the created method, calling the WrongAnswer method we just set up.

For this question, the correct answer is 2017, so for buttons 1, 2, and 4 we need to call

Answer(false);

And for button 3:

Answer(true);


Now run the app and use the remote (or keyboard and enter key) to interact with the buttons. As you can see, the system automatically handles the focusing of each control in terms of moving around with the remote—simply swipe in the direction you wish to go!

Summary

We’ve just created a very simple tvOS app to provide an orientation to the tvOS platform. As discussed, many of the controls and features have been directly brought over from iOS, making creating TV Apps simple and easy. Bringing your apps to the big screen has never been easier with Xamarin!

Stay tuned for more tvOS blog posts in the future, where we’ll discuss more advanced topics, such as gesture detection with the Remote, serving TVML apps and video streaming with Azure, and go into further details about the fundamentals of the platform.

To find the code for this app we created in this blog post, please head over to GitHub. Join the discussion on the forums.

The post Introduction to tvOS appeared first on Xamarin Blog.

December 8

Native Forms is Polished and Shiny in Xamarin.Forms 2.5.0

Since we previewed Native Forms in June, we’ve been working to smooth the rough edges and polish it up for Xamarin.Forms 2.5.0 by fixing bugs and integrating the excellent feedback from the community.

Last month at Microsoft Connect(); in New York, several Native Forms examples were used in the keynote presentation. Most notably, James Montemagno demonstrated adding a Xamarin.Forms page to the open source Kickstarter iOS application. You can watch the entire keynote on Channel9.

Another example is the SmartHotel360 suite of applications, which includes a maintenance application that uses Native Forms to composite Xamarin.Forms pages into native Xamarin.iOS and Xamarin.Android applications. The full code for these applications will be made available soon on GitHub.

This post covers these changes and serves as a guide for you to get started embedding Native Forms in your own applications.

What is Native Forms?

The tl;dr; is that Native Forms allows you to use a Xamarin.Forms ContentPage in a native Xamarin.iOS, Xamarin.Android, or UWP application.

But why, you may ask, would I want to do that? Let’s consider some scenarios:

Existing Xamarin.Forms Reuse

Perhaps you wrote a login page for a service in a previous Xamarin.Forms project. Now, you’re working on a native Xamarin project which uses the same service. Rather than write that page again, you can simply reuse it directly from the Forms project.

Migrate Xamarin.Forms to Xamarin Native

Let’s say you used Xamarin.Forms to quickly create a prototype or proof-of-concept application. For version two, you have decided that on iOS you need to go native. However, you’re not thrilled with the prospect of rewriting every single page from the prototype for your native app. With Native Forms, you can reuse pages from the prototype and only rewrite what you absolutely have to.

Mix Xamarin.Forms into Xamarin Native Projects

You’re working on multiple native projects and facing the prospect of writing the same “Settings” and “About” pages three times. Stop! Just write them once in a Xamarin.Forms project and embed them in your native apps!

A Simple Scenario

To show Native Forms in action, let’s walk through a scenario with some code. The full code for this example can be found on GitHub.

Let’s say I’m creating brand new native applications for UWP, Android, and iOS. In each one, I’d like to add a tip calculator, but I really don’t want to write three tip calculators from scratch. Luckily for me, Charles Petzold has already written one in Xamarin.Forms, so all I have to do is embed it in each of the native apps.

In the demo solution, I’ve created three native projects, plus a project for the TipCalc code:

Solution
Solution

In my TipCalc project, I’ve simply copy-pasted the code from the original TipCalc solution’s PCL project. The code works as-is without any changes, but in my project I’ve updated some obsolete XAML and added some MessagingCenter code, which I’ll talk about later.

To embed the code in each native application, I need to add a reference to the TipCalc project and install the Xamarin.Forms NuGet package. Once I’ve done that, my references in each native project will look something like this:

iOS project references
iOS project references

Before each native project can embed any Xamarin.Forms pages, they need to initialize Forms by calling Forms.Init(). When a native application does this is up to you, as long as it happens before constructing any instance of a Forms ContentPage. You may choose to do it at startup (e.g., during UIApplicationDelegate.FinishedLaunching() or Activity.OnCreate()), or you may want to wait until right before the first ContentPage is constructed. The right option for you will depend primarily on when it’s most convenient in your application flow.

After Xamarin.Forms is initialized, it’s just a matter of setting up navigation to the TipCalcPage. Native Forms adds some extension methods to Xamarin.Forms, which handle converting a ContentPage to the appropriate native type.

In a native iOS project, for example, you would normally use UINavigationController.PushViewController() with a UIViewController. Native Forms provides an extension to ContentPage, which converts the page to a UIViewContoller for you. The method for navigating to the tip calculator could be as simple as:

public void NavigateToTipCalc()
{
    _navigation.PushViewController(new TipCalcPage().CreateViewController(), true);
}

where _navigation is a UINavigationController. That’s it; call that method from the “Tip Calculator” button and the application navigates to the Xamarin.Forms page.

Navigating to the embedded Forms page on iOS
Navigating to the embedded Forms page on iOS


On Android, Native Forms provides the CreateFragment() and CreateSupportFragment() methods. These will convert a ContentPage into a Fragment suitable for navigation. For example, add a method like this to a FragmentActivity:

public void NavigateToTipCalc()
{
    var ft = SupportFragmentManager.BeginTransaction();

    ft.AddToBackStack(null);
    ft.Replace(Resource.Id.fragment_frame_layout,
        new TipCalcPage().CreateSupportFragment(this), "TipCalc");

    ft.Commit();
}

Navigating to the embedded Forms page on Android
Navigating to the embedded Forms page on Android


For native UWP applications, navigation is typically done with the Frame class; the Frame.Navigate() method takes a Page type and navigates to an instance of it. Native Forms provides a similar extension to Frame, which takes a ContentPage instance. Navigating can be as simple as:

private void NavigateToTipCalc()
{
    Frame.Navigate(new TipCalcPage());
}

Navigating to the embedded Forms page on UWP
Navigating to the embedded Forms page on UWP


As you can see, using Native Forms doesn’t take a whole lot of code.

Handling Communication

Chances are good that you also need to communicate between the native context and the Xamarin.Forms portions of your apps. If you’re reusing Xamarin.Forms code from another project, you may already have something set up using whatever event aggregator, message bus, or other method makes sense for your stack. But if you don’t already have something in place, Xamarin.Forms comes with a built-in messaging service (called MessagingCenter) which can be used to wire up communications between native applications and the Xamarin.Forms pages they host.

In this demo solution, I’ve modified the TipCalc project a bit to allow it to send and receive data to and from its host app using MessagingCenter. I’ve defined messages and their arguments:

public static class Messages {
    public static object Sender = new object();
    public const string InitialAmount = "InitialAmount";
    public const string Tip = "Tip";
}

public class InitialAmountArgs {
    public InitialAmountArgs(double initialAmount) {
        InitialAmount = initialAmount;
    }

    public double InitialAmount { get; }
}

public class TipArgs {
    public TipArgs(double tip) {
        Tip = tip;
    }

    public double Tip { get; }
}

With that infrastructure in place, it’s easy for the native applications to specify an initial amount for the tip calculator. Each native app has a field for entering the initial amount; when the user updates that field, a message is sent:

MessagingCenter.Send(TipCalc.Messages.Sender, TipCalc.Messages.InitialAmount, 
    new InitialAmountArgs(InitialAmount));

The view model in the TipCalc project (TipCalcModel) listens for that message and reacts accordingly:

MessagingCenter.Subscribe<object, InitialAmountArgs>(this, Messages.InitialAmount, (s, e) =>
{
    SubTotal = e.InitialAmount;
});

It’s also simple for the native apps to respond to changes in the calculated tip value. Whenever the TipAmount in TipCalcModel changes, it sends a message:

MessagingCenter.Send(Messages.Sender, Messages.Tip, new TipArgs(value));

The native application can listen for that message and react; for example, the iOS application sets the text of a UILabel:

MessagingCenter.Subscribe<object, TipArgs>(TipCalc.Messages.Sender, TipCalc.Messages.Tip,
    (obj, args) => TipAmount.Text = args.Tip.ToString("C"));

Here’s the app in action on UWP. The user enters an initial amount, which is passed to the tip calculator, and the result from the tip calculator is relayed back to the native page:

Communication on UWP
Communication on UWP

Just Pages?

Savvy readers will have noticed that the extension methods all provide return types that don’t necessarily require full page navigation. It’s also possible to use UIViewController, FrameworkElement, and Fragment as part of a page rather than a full screen. We previously showed how to display a ContentPage on UWP inside of a Flyout, instead of a full page.

In theory, these methods could be used to embed a ContentPage as part of a larger page on each platform. As of right now, that’s very much an officially unsupported use case. That said, if you experiment with that use case, I’d love to hear how it works for you.

Update to 2.5.0 Today!

You can begin using Native Forms today in our latest stable version, Xamarin.Forms 2.5.0, available on NuGet. If you have any feedback or suggestions, please let us know in the forums!

The post Native Forms is Polished and Shiny in Xamarin.Forms 2.5.0 appeared first on Xamarin Blog.

Default ColorSpaces

Recently a user filed a bug where the same RGB color when converted into a UIColor, and later into CGColor is different that going from the RGB value to a CGColor directly on recent versions of iOS.

You can see the difference here:

What is happening here is that CGColors that are created directly from the RGB values are being created on kCGColorSpaceGenericRGB colorspace. Starting with iOS 10, UIColor objects are being created with a device specific color space, in my current simluator this value is kCGColorSpaceExtendedSRGB.

You can see the differences in this workbook

December 7

Even Easier iOS App Provisioning in Visual Studio for Mac 

iOS provisioning is a notoriously hard concept to grasp; even the best developers can be stumped by a signing identity. As a content developer at Xamarin, I’ve created thorough documentation on the topic, which you can read in the Xamarin Developer Center. Having these resources is great, but as a developer making something awesome, you shouldn’t have to understand how Apple’s signing process works; you should just be able to make a selection, hit run, and have your app deploy to your device. It should be that simple.

In June, we introduced improvements that make it easy to deploy your iOS app to a device. We have improved this process once again with our latest release, and now you can automatically provision your app in less than a minute with a single checkbox selection! In this post, you’ll learn how to turn on automatic signing and allow Visual Studio for Mac to take care of generating and using the required signing artifacts.

Getting Started

Before you begin, you’ll want to make sure that you’ve signed in to Visual Studio for Mac with an Apple ID via the Apple Account Management window. To open the account management window, go to  Visual Studio -> Preferences -> Apple Developer Account. Click the + button to enter your Apple ID and password. Your credentials are saved in the secure Keychain on your machine, and fastlane is used to handle your credentials securely while passing them to Apple’s developer portal.

Enabling Automatic Signing

Once you’ve ensured you have an Apple ID connected to Visual Studio for Mac, you’re ready to enable Automatic Signing.

In your iOS project, open the Info.plist file. In the Signing section, select your team from the Team dropdown:

Then, select the Automatically manage signing  checkbox:

This starts the automatic signing process. Visual Studio for Mac will then attempt to generate an App ID, provisioning profile, and a signing identity to use these artifacts for signing.

When automatic signing has been enabled, Visual Studio for Mac updates the provisioning artifacts, if necessary, when any of the following things happen:

  • An iOS device is plugged into your Mac.
    • Visual Studio for Mac checks to see if the device is registered on the Apple Developer Portal. If it is not, then the device is added and a new provisioning profile is generated.
  • The bundle ID of your app is changed.
    • Visual Studio for Mac updates the app ID to match the bundle ID. A new provisioning profile containing this app ID is generated.
  • A supported capability is enabled in the Entitlements.plist file.
    • This capability is added to the app ID and a new provisioning profile with the updated app ID is generated.
    • Not all capabilities are currently supported. For more information on the ones that are supported, check out the Working with Capabilities guide.

In Action

For a full breakdown of automatic signing and a walkthrough of a live demo, check out this episode of the Xamarin Show with James and Oleg!

Wrapping Up

This blog post introduced the new automatic signing capabilities in Visual Studio for Mac 7.3 and demonstrated just how quickly you can now deploy your iOS, tvOS, and watchOS apps to a device.

For more information on Device Provisioning, refer to our documentation on Setting up a device for development.

Discuss this post in the Xamarin Forums!

The post Even Easier iOS App Provisioning in Visual Studio for Mac  appeared first on Xamarin Blog.

December 6

Get Your Azure Mobile Badge from Xamarin University!

We’re excited to introduce the Azure Mobile badge, our first non-certification badge, offered exclusively through Xamarin University!

Unlock this badge by completing the Xamarin University Azure courses, all of which are available as Self-Guided Learning courses. Once earned, the badge will appear on your Xamarin University profile. If you’ve already taken some of the courses, that attendance will be applied towards this badge!
 

This badge is available to all Xamarin University students, including those with a trial. If you don’t already have a subscription, you can get started today for free.

Show off your Azure knowledge by earning your badge today!

The post Get Your Azure Mobile Badge from Xamarin University! appeared first on Xamarin Blog.

December 5

Fidelity Mobile Unites Brazilian Citizens and Elected Officials with Real-Time Chat Apps

Real-time messaging apps are becoming commonplace, allowing us to communicate immediately or asynchronously with individuals and groups. Inspired by chat apps’ success with consumer businesses, Fidelity Mobile and the Legislative Assembly of Mato Grosso, one of Brazil’s state governments, developed their a real-time m-government chat app. Now, with the ALMT Interactive apps (available on Android, iOS, and Windows), Mato Grosso’s 3M+ citizens reach elected officials members and communicate with other residents at any time, earning points, titles, and awards based on their level of engagement.

Today, Valdemar Mendonça, Director of Research, Development & Innovation and Kassia Masson, Director of Business and Innovation at Fidelity Mobile, join us to share how Visual Studio Tools for Xamarin, Azure, and Visual Studio App Center helped their eight-member development team get intuitive, secure apps to market quickly, in part by sharing 89% of code across platforms. They’re combining popular consumer UX features (like chat and gamification), enterprise-grade security, and intelligent cloud services, including translation, and seamless data access, to drive citizen engagement, ensure every resident has the chance to be heard, and increase transparency and trust.

Tell us a little bit about your company; who are your customers?

Fidelity Mobile on iOSWe were founded in 2006 and, at our core, we combine our expertise with how governments operate with our expertise in creating engaging mobile experiences that fit into modern life.

All of our projects have one thing in common: they focus on the individual, connecting members of society to government officials, public sector services, or private institutions. We want to use technology to foster equality and visibility for each and every citizen. This is especially critical in Brazil, where citizen engagement is key to gaining and keeping citizens’ faith in government stability and integrity.

We were early mobile pioneers, starting with the simplest mobile capabilities. We were the first Brazilian company to provide a public service via SMS, and we won the World Summit Award (m-government and participation category) in 2010 for our project that allowed citizens to send and receive text messages to view their license status, outstanding fines, and more (big problems in Brazil!).

Our empowerment mentality extends to our corporate culture; we have profit-sharing and a continuing training program that encourages #Fidelityanos (employees) to innovate.

I’m an economist by trade, I received my Ph.D. in Economic Sciences, but I’ve been working in the mobile innovation management space for more than 10 years, and I sponsor and lead our development teams. Kassia Masson is our Director of Business and Innovation, with a Ph.D. in Law, and co-author* of our scientific merit innovation projects, including our work with the State of Mato Grosso. We work together on all stages, from research and design to kickoff and planning to execution and product launch.

*In Portuguese, we call it co-authorship when two or more people collaborate on a project together.

Tell us about your app and what prompted you to build it. What were your goals?

Our goal is to launch a society-changing solution every 12 months, and the ALMT Interactive app is just that. We’re helping our government deliver transparency, speed, mobility, and convenience while maximizing existing resources and budgets.

Historically, the Legislative Assembly of the State of Mato Grosso was hard to contact; citizens could only use traditional means, like phone calls (complete with holds, prompts to enter extensions, and games of phone tag) and the website. That doesn’t fit into modern life, where people expect anytime, anywhere access and want to engage with their elected officials and other residents in their moment of need.

Now, with the ALMT Interactive app, citizens register, create a profile, and use our apps to interact and collaborate in a more comfortable manner. Users search a directory of contacts and opt to click-to-call officials, or use our real-time chat service (created to model popular consumer chat apps) to send video, text, or audio files. We’ve also made all information available on and offline, as various regions lack stable connectivity, and developed apps for Android, iOS, Windows Phone, and Windows 10.

For reference, Mato Grosso has just over 3.3 million residents, and mobile phone penetration is extremely high (145.43 cell phones per 100 inhabitants, per Anatel, Brazil’s national telecommunications agency. Read the report here).

Given this, the Legislative Assembly of Mato Grosso has set an aggressive goal: they want 63% of the population to use the app by 2018.

How did you develop an experience that unites citizens and the government?

Fidelity Mobile on WindowsWe approach each project very strategically, with the mantra, “it’s no use to be aesthetically beautiful if it’s not helpful.” For us, it’s extremely important to uphold consistent visual standards; from buttons, bars, and text boxes to images, everything should seem natural for the user.

We’ve partnered with the Mato Grosso Legislative Assembly to design an experience that connects the “people” and public power by offering something truly unique: allowing citizens to talk directly to their legislators and legislative bodies at no cost, as well as chat with other users.

Beyond usability and navigability, we wanted to be more than a mere information channel, creating a channel of two-way communication, collaboration, interaction, and social engagement.

ALMT mirrors popular consumer real-time chat and social networking apps, with features including:

  • Chat Member + Chat Citizen (on and offline): Easily search and begin direct messages with elected officials, and reach out to other citizens to discuss local or national issues, both with or without an internet connection. Users can opt to send messages via SMS if they’re in an area of limited connectivity.
  • Gamification: Earn points, rise in “rankings” leaderboards, and win trophies. The more active and engaged users are with their government and fellow citizens, we reward them with special status, including the title of “most collaborative citizen.”

You can also see the app in action and read more about the project in our recent news coverage.

What do you think of when you hear the phrase, native app?

For us, native apps have a fluidity and usability that’s hard to describe, but when you see it, you know it. Native quality is critical for us; we want to take advantage of all device operating system features, including camera, GPS, accelerometer, compass, contact lists, push notifications, and gesture-based interaction.

Can you describe your development process for us?

Fidelity Mobile has always used Microsoft technologies to develop apps. Our team is led by Rafael Rodrigues Moura (Microsoft MVP, Xamarin MVP, & Certified Developer) and comprised of Daniel Masson (our Project Manager), as well as a mobile developer (for all three platforms), Value-Added Service (VAS) Analyst, web developer, designer, quality assurance analyst, and two support technicians.

Since we all have domain expertise in .NET and C#, Visual Studio Tools for Xamarin lets us use familiar programming syntax and unique C # features (like LINQ and Lambda Expression), while tapping into native visual objects and hardware (like the ability to include photos, location, and more).

With the addition of Xamarin.Forms, we share 89% of our code across Android, iOS, and Windows (over 20,000 lines)!

We’re big believers in DevOps and cloud services, and we automate nearly everything, including compiling code in Git, validating commits, UI testing, and distributing to our human testers. We use Visual Studio Team Services and Visual Studio App Center from planning to execution for project management, development, version and source control, quality, and ongoing communication. Visual Studio Team Services helps us automate compilations and distribution and Visual Studio App Center’s CI, Push, Crash, and Analytics services simplify kicking off new builds, logging versions, testing, and viewing and reporting errors.

As a team, we use agile methods, like Kanban, Task Reports, and Sprints; Visual Studio Team Services’ Boards, Manage, Charts, Code Version, Tests, and Wiki features help us complete projects on time, on budget, and within scope. App Center services give our team additional visibility on the latest commits and stats, allowing us to take quick action.

We shipped ALMT in just 12 months, which was huge for us, including making it available on three platforms and being fully approved by our government stakeholders. Without Xamarin, it would have taken twice as long, and also meant we’d have had to maintain, test, and update three different codebases, rather than sharing the majority of source code across all platforms.

What role does automated testing play in your development?

Fidelity Mobile on AndroidQuality creates security and peace of mind for all project stakeholders, especially since we operate in the m-government space. It would be a catastrophe if our apps were buggy or crashed since security and user trust are central to our mission.

We’ve guaranteed a 95% SLA to the Legislative Assembly of Mato Grosso, which wouldn’t have been possible without Xamarin Test Cloud. We run dozens of automated tests on hundreds of different cell phone versions, testing clicks, data entry into sign-up forms and surveys, interaction with hardware, and gestures throughout the application.

To us, this means that we guarantee quality and access to as many citizens as possible while remaining dedicated to upholding our SLA standards.

What has your experience with Visual Studio App Center been like?

The most useful feature for us is the Test service reports; we capture errors that we didn’t catch during our debugging, the ones that happen in real-world environments. From there, we quickly view the stack traces to fix problems before we go into production.

We also use the Crash service for our beta and production builds, creating tasks for every error and prioritizing fixes accordingly. The quality and detail of the bug reports are amazing, and the ability to see all of our Android, iOS, and Windows apps in one place is incredible.

What does Microsoft Azure allow you to accomplish?

Offline functionality is critical to us. While the vast majority of apps require a constant connection to perform simple functions such as opening, browsing, and accessing menus, we always make our core functions available on and offline.

Azure also has several artificial intelligence APIs; we integrated with the Cognitive Services Translator Text API. With a few lines of code, we could translate our entire app using the Bing translation engine without any manual work or custom code.

What have your users said about your apps?

Users are especially excited about the citizen and deputy chat, as it’s something that’s never been possible before. Now, Brazilian citizens can send text messages and files directly to their elected officials via real-time messages, just like they use popular messaging apps to communicate with friends, family, and co-workers.

Have you accomplished your goals?

Yes, but we have many more goals. We want to get to that 63% penetration with the ALMT app and execute the 85 other app projects on our roadmap (in partnership with the Brazilian government, as well as other research and innovation organizations).

We’ve also recently launched our first private-sector applications – Mobile Chat and Web Chat, using the technologies from our m-government innovation projects and making them available to companies and developers everywhere. Our goal is to change the way companies and governments around the world communicate with their customers, citizens, and employees.

What advice do you have for developers just starting out or investigating mobile development?

Our main piece of advice is to use Xamarin! Put in the work to learn best practices by going through the Microsoft Virtual Academy and Xamarin University coursework, and you’ll be set to use all of Microsoft’s technology and services, from Visual Studio Tools for Xamarin and Azure to Visual Studio App Center.
 

Visit xamarin.com/customers to learn how our customers across industries and geographies deliver amazing mobile apps, and visit xamarin.com/download to start building your own.

The post Fidelity Mobile Unites Brazilian Citizens and Elected Officials with Real-Time Chat Apps appeared first on Xamarin Blog.

December 4

See What’s New in Visual Studio 2017 Version 15.5

Today, we’re releasing Visual Studio 2017 version 15.5 into stable. This release includes many improvements for mobile developers, including enhancements to XAML editing, the Xamarin Live Player, File -> New Project, and our Mac pairing mechanism. We’ve also made our Remoted iOS Simulator feature available in all editions of Visual Studio, including the free Community Edition!

You can update to Visual Studio 2017 version 15.5 today by opening the Visual Studio Installer and clicking ‘Update’. For more details about what’s included in this release, be sure to check out the details below.

XAML Previewing with the Xamarin Live Player

Building UIs with Xamarin.Forms has become even easier with the Xamarin Live Player in Visual Studio 2017 version 15.5. This release adds the ability to preview XAML in an Android emulator (Windows and Mac) or an iOS simulator (Mac only) live as you type, including support for rendering design-time data:


Previewing XAML with the Xamarin Live Player feels natural; as you move from document to document, Visual Studio will automatically preview the active XAML document for you. Entering “Live Run” mode to quickly iterate and see code changes reflected in your UI on device or simulator is as easy as pressing Shift+Alt+F5, or by clicking the “Live Run” button that appears at the top of the editor for XAML.

Live Player devices act and feel just like regular emulator and device debug targets. The Xamarin Live Player already supports breakpoints when debugging, and we’ve improved how the overall functionality integrates into Visual Studio in this release, including integration with the Console and Error windows.

Remoted iOS Simulator for All

The Remoted iOS Simulator, which allows developers to test and debug iOS apps entirely in Visual Studio on Windows, is now available to all editions of Visual Studio, including the free Community Edition! The simulator supports functionality like location simulation, rotation, gestures, and even includes functionality that the iOS simulator on Mac does not, like multi-touch.

SmartHotel360 app running in the Remoted iOS Simulator with Visual Studio on Windows.

To begin using the Remoted iOS Simulator today, update to Visual Studio 2017 version 15.5 and select an iOS simulator. Once the debug session begins, the simulator will automatically launch on your Windows machine.

File -> New Project

Developers are excited about .NET Standard for sharing code across iOS, Android, and Windows, and have been asking us to make it easy to get started with Xamarin.Forms and .NET Standard. Beginning today, File -> New -> Cross-Platform App (Xamarin.Forms) will give you the option to select .NET Standard as your code sharing strategy. In addition, we know that sometimes you begin a project with certain platforms in mind, so we have also added the ability to select which platforms your app will target.

File -> New Project -> Mobile App

.NET developers know the pain that is packages.config. This file is meant to be a canonical list of all NuGet packages referenced by an app, but quickly turns into an unmanageable mess. That’s why starting with this release, all new Cross-Platform template projects will use PackageReference, a new way to manage NuGet packages directly in the .csproj file. One of my favorite things about PackageReference is that all packages listed are transitively restored, meaning that you only need to define the top-level NuGets that your app consumes; no more dealing with the 100s of dependencies that your packages reference!

To manage packages, you can continue to use the NuGet Package Manager, or directly edit your .csproj to add something like this:

<ItemGroup>
    <PackageReference Include="Xamarin.Forms" Version="2.4.0.282" />
</ItemGroup>

Finally, we also spent time making the template “unfold” process faster. You should notice that a new Xamarin.Forms template project unfold is 5-10x faster than it was in previous releases.

Pair to Mac

We’ve made it easier to pair your Windows machine to a Mac to build iOS apps with the introduction of a new connection workflow. Once a connection is initiated to a Mac, a status bar is shown with the progress of your connection attempt and any actions or issues will display directly in the status area.

New connection workflow for the Xamarin Mac Agent.

We Need Your Feedback

We need you to help shape the future of Visual Studio Tools for Xamarin! Be sure to let us know what you think of Visual Studio 2017 version 15.5 by tweeting us on Twitter @xamarinhq or @pierceboggan. Be sure to also report bugs, performance issues, and other strange behavior by using Help -> Feedback -> Report a Problem within Visual Studio. For more information on Visual Studio 2017 version 15.5, check out the Visual Studio blog and release notes.

Discuss this post in the Xamarin Forums

The post See What’s New in Visual Studio 2017 Version 15.5 appeared first on Xamarin Blog.

Distrinet R&D Bites

The Distrinet Research Group at KULeuven (where I studied!), recently asked me to speak about “Cloud Native” at one of their R&D Bites sessions. My talk covered Kubernetes, cloud automation and all the cool new things we can do in this brave new cloud native world.

Annotated slides of the talk can be found here.

Experiences in building cloud-native businesses: the Ticketmatic case


Comments | More on rocketeer.be | @rubenv on Twitter

December 1

Podcast: Xamarin.Forms 2.5.0, Live Player, and What’s New in Visual Studio for Mac

In this episode of the Xamarin Podcast, James Montemagno and I cover the latest news for mobile developers from Microsoft Connect(); 2017, including Xamarin.Forms 2.5.0 and awesome updates to the Live Player, Visual Studio 2017, and Visual Studio for Mac.

Be sure to download today’s episode from your favorite podcasting 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: Xamarin.Forms 2.5.0, Live Player, and What’s New in Visual Studio for Mac appeared first on Xamarin Blog.

Xamarin Developer Events in December

The .NET developer community is vastly expanding, so there’s more opportunity than ever to network with local user groups and learn about new and exciting releases, tooling, and updates to Xamarin and related technologies. ‘Tis the season to enhance your knowledge of native mobile development!

Xamarin Dev Days Rijeka 2017

Below are just a few of the Xamarin events happening around the world this December; find one here, or search through even more on the Xamarin Events page to find an event near you!

December 2:

  • Pune, India | Pune DevCon 2017: 5 Tracks covering 20+ sessions on technologies like Xamarin, Visual Studio, Azure, IoT, Blockchain, and more!
  • Lathan, NY. USA | Xamarin Dev Days Latham: Learn Xamarin from start to File->New app in this full day of sessions and a lab with Xamarin experts hosted by Tech Valley User Group.

December 5:

December 6:

  • Copenhagen, Denmark | Sii Conference: Sii and Microsoft team up to show how new technology makes it easier to design and develop cross-platform mobile applications with Xamarin.

December 12:

December 13:

  • Webinar | Xamarin: Get the Most out of Android 8 Oreo with Visual Studio Tools for Xamarin.

December 14:

  • Webinar | Xamarin: Get the Most out of iOS 11 with Visual Studio Tools for Xamarin.

December 16:

  • Verona, Italy | Xamarin on the Rocks: Join local user group CloudGen Verona and several industry experts for a full day of Xamarin training and labs.

December 19:

 

New Xamarin user groups and events are constantly being announced, so we can’t fit all of the awesome opportunities in one place. For the full list of mobile .NET developer events, browse through our Xamarin Events page, and sarch for Xamarin events happening around the world or pick one close to home by filtering by location. New events and user groups are being added often, so be sure to check throughout the month for updates.

Can’t find a user group near you?


Start one of your own! These helpful resources offer tips on how to organize a local Xamarin User Group:

Feel free to send us an email or tweet @XamarinEvents to let us know about Xamairn related events in your area, and we’ll help you promote them. You can also post your event details in our Events Forum to be included in the following month’s event blog post!

Don’t forget to browse the Xamarin events page for even more Xamarin meetups, conferences, hackathons, and other tech gatherings happening near you this month.

The post Xamarin Developer Events in December appeared first on Xamarin Blog.

November 30

Supercharge Your Xamarin.Mac Application Startup Time

Startup performance matters, as it’s the first feature users come across when using your application. In this post, we’ll walk through some recent samples that improve Xamarin.Mac startup times, especially for large applications, featuring a few build options that change startup time drastically, including one that cuts startup time by 77ms or about 15%.

Let’s start with the SourceWriter, a simple but full Xamarin.Mac application sample that provides a text editor with code completion and syntax highlighting.

Launching a Debug build takes around a half a second, which isn’t bad, but is difficult to measure manually. By applying the technique from this sample and averaging five launches of the application, we can measure an average startup time of 574ms.

To determine how much overhead is related to Debug, switching to Release configuration can drop the time to 454ms, a 20% + improvement! A vast majority of this improvement is due to the Static Registrar, which you can see by adding registrar:static to the MMP arguments (Project Options → Mac Build), giving 477ms.

Registrar Settings

To understand what the registrar settings are doing, we have to dig a bit under the hood. During startup, the Objective-C runtime needs to be informed of the various managed classes that derive from NSObject and the selectors they support. The three options for the registrar setting are Partial Static, Static, and Dynamic.

  • The Partial Static registrar uses reflection on user assemblies during startup and is the default for Debug builds.
  • The Static registrar scans all assemblies and generates code at build time, which is a significant performance improvement (17% in this example). In contrast, it also increases build time, which is why it’s only on by default for Release configurations.
  • There’s also a Dynamic registrar which reflects overall assemblies at startup, not just users assemblies. Previous to Xamarin.Mac 3.2, when the “Partial Static” registrar was introduced, this was the default for Debug configurations.

Compilation

Another job done at startup is a compilation of managed code from IL to machine code. While JIT compilation is incredibly fast in most cases, for large applications it can take up a significant percentage of startup time. Ahead of Time (AOT) compilation compiles assemblies to machine code (dylibs) during the build and bundles them inside the final application bundle.

Enabling AOT requires passing a command line argument via the “Additional MMP arguments” field in Mac Build. Full AOT options will be added to the Mac Build panel in Xamarin.Mac 4.2. The current options are as follows:

aot[=VALUE]          Specify assemblies that should be AOT compiled
                           - none - No AOT (default)
                           - all - Every assembly in MonoBundle
                           - core - Xamarin.Mac, System, mscorlib
                           - sdk - Xamarin.Mac.dll and BCL assemblies
                           - |hybrid after option enables hybrid AOT which
                           allows IL stripping but is slower (only valid
                           for 'all')
                            - Individual files can be included for AOT via +
                           FileName.dll and excluded via -FileName.dll

                           Examples:
                             --aot:all,-MyAssembly.dll
                             --aot:core,+MyOtherAssembly.dll,-mscorlib.dll

In the SourceWriter example, aot:all reduces startup time to a quick 377ms. This is below the 400-500 ms goal that many users will consider “instant,” and a good place to be.

While AOT compilation is great and can provide that last push to get under the desired performance window, it does have some drawbacks to consider. In SourceWriter, it increases build time by 40% and doubles the final application bundle size (i.e. 12 megs to 24 megs).

More Build Settings

Other build settings to consider are Target Framework and Linking mode. Linking can dramatically reduce application size by removing unused code, but is only available in some Target Framework configurations. Applications optimized with Linking are great candidates for AOT compilation.

Even after configuring build settings, your application still might miss your desired performance benchmarks. Consider reviewing the performance documentation and profile your application.

If you’re interested in Xamarin.Mac, Hello, Mac is a great place to get started. There are a number of tutorials covering macOS specific user interface controls and a wealth of samples to look at. The Xamarin.Mac forum community is also open for discussions and questions as well.

The post Supercharge Your Xamarin.Mac Application Startup Time 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