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.

July 24

Building the Xamarin.Forms NuGet

A great way to explore Xamarin.Forms (and grow comfortable working in the code) is to clone the repository and run it, especially any of the ControlGallery projects. We know that many of you have done just that, so the next step you can take is to make your own customizations to Xamarin.Forms to build and distribute your very own NuGet package within your organization. In this post, let’s walk through doing that locally, and then discuss how you can configure the same on Visual Studio Team Services (VSTS).

The Local Setup

Windows to Build it All

Building a Xamarin.Forms Nuget locally is most easily done on a Windows machine. You’ll want to use Visual Studio 2015 if you’re including the soon-to-be-deprecated Windows Phone 8 and 8.1, or you can use Visual Studio 2017. The build is quite straight forward:

  1. Select Debug or Release
  2. Right click the solution and select Build.

I can hear you asking, “But what about a Mac build host, do I need one?” because I asked the very same question my first time. Because we’re generating a NuGet and not an iOS or Mac application, we don’t need the Mac build host. We’re building against the Xamarin and Windows framework SDKs.

Once the solution is done building successfully, you should generate the xml used for displaying documentation within the IDE. Now you’re ready to package the freshly made assemblies into a NuGet package. To accomplish this, we have a handy create-nuget.bat script that you execute from the command line by name.

if "%DEBUG_VERSION%"=="" set DEBUG_VERSION=0
set /a DEBUG_VERSION=%DEBUG_VERSION%+1
pushd docs
..\tools\mdoc\mdoc.exe export-msxdoc -o Xamarin.Forms.Core.xml Xamarin.Forms.Core
..\tools\mdoc\mdoc.exe export-msxdoc -o Xamarin.Forms.Xaml.xml Xamarin.Forms.Xaml
..\tools\mdoc\mdoc.exe export-msxdoc -o Xamarin.Forms.Maps.xml Xamarin.Forms.Maps
popd
pushd .nuspec
..\.nuget\NuGet.exe pack Xamarin.Forms.nuspec -properties configuration=debug;platform=anycpu -Version 9.9.%DEBUG_VERSION%
popd

You can update this directly to use the version and build configuration of your choice. Note, the current script is set to expect the debug configuration. Also, notice the docs are being updated first and then the NuGet is being generated.

The NuGet package will be in your root directory when it’s complete.

Building on OS X

While you can build Xamarin.Forms on a Mac, I don’t recommend it. You immediately have to trim out all the Windows targets, meaning any NuGet you create will only work on iOS, Android, and Mac. If you are on a Mac and cannot build on a Windows machine, then building on VSTS is for you!

Cloud Building on VSTS

Visual Studio Team Services provides a wealth of tasks to create a very flexible build solution, and for our needs it will:

  • Get Xamarin.Forms Source
  • Restore NuGet packages
  • Build the solution
  • Generate the documentation
  • Package the NuGet
  • Publish it

Sounds easy enough, right?

First things first, we need a project on VSTS. Click New Project from your VSTS landing page and fill in your preferences. Once that’s created, go to the Build & Release tab for the project. Create a new Build definition and start adding those tasks!

Get Xamarin.Form Source

VSTS provides templates for a variety of common scenarios, but we’ll start with an Empty process. For the “Default agent queue” select Hosted.

There’s one task provided for us, and that’s Get Sources. Choose that task and configure from where you want to pull your Xamarin.Forms code.

  • This project
  • Github
  • Remote repo
  • Subversion

Restore NuGet Packages

As usual, before we can build any solution including Xamarin.Forms, you want to make sure any NuGet dependencies have been restored. Visual Studio kindly does this for you by default when running a build locally.

Click Add Task and add the “NuGet” task. Change to 0.* in the Version drop down for the task. This provides the ability to customize NuGet arguments more easily. For the “Path to Solution” enter “Xamarin.Forms.sln” since it’s in the root of the repository.

Make sure the “Installation type” is set to Restore.

Include these arguments:

-source "https://www.nuget.org/api/v2;https://www.myget.org/F/nuget;https://www.myget.org/F/xamarinforms-ci/api/v3/index.json;https://www.myget.org/F/yoga/api/v3/index.json;https://www.myget.org/F/xamprojectci/api/v3/index.json;"

Build The Solution

Now we’re ready to build the solution. Add another task and this time choose “Visual Studio Build”. Again, point to the “Xamarin.Forms.sln”. Add variables you can change depending on what you want to build in the Platform and Configuration fields.

Platform: $(BuildPlatform)
Configuration: $(BuildConfiguration)

When you kick off the build later, these will be options you can set.

Check the Clean box.

Generate The Documentation

Build all the appropriate xml files needed by the IDEs to display documentation. To do this you’ll need one Batch Script and three Command Line tasks. You’ve already mastered finding tasks and adding them to the process, so let’s forgo repeating that. Here are the settings for those tasks.

Batch Script
Display Name: Update XML Documentation
Path: update-docs-windows.bat

Command Line
Display Name: Generate XML Documentation (Core)
Tool: $(Build.SourcesDirectory)\tools\mdoc\mdoc.exe
Arguments: export-msxdoc -o Xamarin.Forms.Core.xml Xamarin.Forms.Core
Working Folder: docs

Command Line
Display Name: Generate XML Documentation (XAML)
Tool: $(Build.SourcesDirectory)\tools\mdoc\mdoc.exe
Arguments: export-msxdoc -o Xamarin.Forms.Xaml.xml Xamarin.Forms.Xaml
Working Folder: docs

Command Line
Display Name: Generate XML Documentation (XAML)
Tool: $(Build.SourcesDirectory)\tools\mdoc\mdoc.exe
Arguments: export-msxdoc -o Xamarin.Forms.Maps.xml Xamarin.Forms.Maps
Working Folder: docs

Package The NuGet

Finally, the step you’ve been waiting so patiently for! Add a “NuGet Packager” task and configure it.

Version 0.*
Patch to the nuspec: .nuspec/Xamarin.Forms.nuspec
Configuration to Package: $(BuildConfiguration)
Addition build properties: IdAppend=.Custom

Publish the NuGet

Perhaps you want to publish to a MyGet feed you control. You can do that here. For simplicity, let’s just put the package in a folder in the VSTS project. Add a task for Publish Build Artifacts.

Get Building

Save and queue your build. From the Builds tab you can access the build history and see your job’s status, any errors, etc.

Ready. Set. Build.

Now you’re all set to build Xamarin.Forms and distribute within your own organization! If you don’t already have a VSTS account, sign up to get started for free. Of course, if you’re making fixes or customizations that everyone can benefit from, please open a pull request on GitHub and share the love.

The post Building the Xamarin.Forms NuGet appeared first on Xamarin Blog.

July 21

July 20

Installing Visual Studio 2017 Made Easy

Visual Studio has evolved quite significantly since its introduction ten years ago, from IDE features to the integration of various DevOps scenarios. With Visual Studio 2017, even the installation experience has changed; developers can now select the components that they wish to download and install, as well as install various releases of Visual Studio side-by-side. Let’s see how we can make an offline installer for Visual Studio 2017, along with Xamarin, with a view to use the offline installer multiple times on other machines. This blog post covers all editions of Visual Studio 2017 including Community, Professional, Enterprise, and Preview releases.

Grab the Installer

Visit the Visual Studio website and download the installer. You can also download the preview installer here.

Once you’ve downloaded the executable, rename it to something readable so it will be easier to use in the command line interface later. For this example, we’ll name ours vs_enterprise.exe.

Download Contents for Offline Install

Visual Studio allows you to build apps for many platforms, using many technologies, making the download size is significant. Luckily, you can download just the required components for mobile development if you only develop for mobile platforms. If you wish to download everything Visual Studio has to offer, run the following command on your command prompt:

C:\>vs_enterprise.exe --layout C:\VS2017 --lang en-US

This will download all of the installation components, with the language set to English (United States), inside the C:\VS2017 folder. Remember, this can be huge in size (usually in excess of 20GB).

There is also an option to download only the components that are required for cross-platform mobile development. These are packaged into workloads. For example:

C:\>vs_enterprise.exe --layout C:\VS2017 --lang en-US --add Microsoft.VisualStudio.Workload.NetCrossPlat

…will download Xamarin and related components, whereas…

C:\>vs_enterprise.exe --layout C:\VS2017 --lang en-US --add Microsoft.VisualStudio.Workload.Universal

…will download components required for building Universal Windows Platform applications. The entire list of workloads is available here.

Almost every mobile app needs to connect to at least one service, such as ASP.NET MVC WebAPI hosted inside Azure. Additional components are required to build and use such services. The following command installs all required components:

C:\>vs_enterprise.exe --layout C:\VS2017 --lang en-US --add Microsoft.VisualStudio.Workload.Azure Microsoft.VisualStudio.Workload.ManagedDesktop Microsoft.VisualStudio.Workload.NetCoreTools Microsoft.VisualStudio.Workload.NetCrossPlat Component.Android.NDK.R13B Component.Android.SDK23 Component.Xamarin Component.Xamarin.Inspector Component.Xamarin.Profiler Component.Xamarin.RemotedSimulator Microsoft.VisualStudio.Workload.NetWeb Microsoft.VisualStudio.Workload.Universal

Once all of the components are downloaded, look for the certificate folder. Install all of the certificates before you run the installer.

Now you can run the offline installer from your folder. It will launch and install all of the components you selected.

Verify Installation

Once the installation is complete, start Visual Studio and check for any updates available for Visual Studio, along with Android SDKs (from Tools > Android > Android SDK Manager), etc.

Create a new cross-platform app project once all of the updates are installed, Xamarin.Forms for example, and run it on your device or emulator. If you get the app running with a ‘Welcome to Xamarin.Forms’ message, then you have installed Visual Studio with all of the required tools for cross-platform mobile development.

Wrapping Up

If you have a development team of more than a handful of developers, or your internet connection has limited bandwidth (or the computers are simply not connected to the internet), then taking the time to create an offline installer for Visual Studio 2017 is definitely a worthy consideration, saving time and valuable resources. You can find more information about Offline Installation an related issues here.

The post Installing Visual Studio 2017 Made Easy appeared first on Xamarin Blog.

July 18

Guitar Center’s Five-Star Xamarin.Forms Apps Bring Music to the Masses

The best brands, and the most popular apps, deliver personalized experiences that help us accomplish exactly what we want to do, when we want to do it. Developers need to create contextual, relevant mobile apps and make it easy for users to transition across device types and platforms, from phones to tablets and web to wearables (and back) as they move through their days in order to win users’ loyalty.

Guitar Center has a steadfast customer following, and it has crafted mobile apps (available on Android and iOS) that not only complement its web experience, but integrate mobile-unique capabilities, such as barcode scanning and locational push notifications, to better serve customers based on their unique scenario and needs. Today, we’ve invited Tony Trupp, Director of E-Commerce at Guitar Center, to share how Xamarin.Forms and HockeyApp allow his team to rapidly deliver more value (and new features) to customers, all while driving more revenue.

Tell us a little bit about your company and role. Have you always been a developer?

Guitar Center App on NexusGuitar Center is the world’s largest musical instrument retailer, with over 280 stores across the United States. We’re currently headquartered in Westlake Village, California. We cater to musicians of all skill levels with services including lessons, repairs, and rentals. Additionally, our GC Pro service offers pro audio recording and live venue products, technical consulting, and other custom services for professional musicians.

I started as a front-end developer for MusiciansFriend.com (Guitar Center’s online-only sister brand), and was promoted to Web Development Manager in 2012. In my current role, Director of E-commerce, I oversee the UX and Platform Operations teams across brands and manage development projects, including the new Guitar Center mobile app.

Most of my development experience has been with PHP/Java/JavaScript/HTML/CSS, with an emphasis in website architecture and user interfaces. While I’ve been doing web development since the mid-nineties, I hadn’t done any work with native mobile apps prior to this project.

Describe your app and what prompted you to build it. How does it fit into your mobile strategy?

We, like the rest of the retail industry, have seen our customers moving away from desktop browsing toward mobile over the past few years. While we’ve had a mobile website for quite a while, we wanted to create a native app that took advantage of native APIs and would better engage our customers.

With our new mobile experience, we wanted to tap into barcode scanning capabilities to allow customers to scan items in stores and bring up product reviews, use push notifications to alert customers when products go on sale or become available, and integrate geolocation to send announcements for new store openings or nearby events. Check our Guitar Center App webpage to learn more about our apps’ features.

Describe your development process.

Guitar Center App on HTCAfter building out an initial Xamarin.Forms prototype in-house, we partnered with Neudesic (Xamarin Elite Consulting Partner) to speed development, since they had experience with both platform-specific and Xamarin mobile development. We wanted to target both platforms and deliver a mobile experience to all of our customers, regardless of their device preferences. Xamarin.Forms allowed us to share almost 98% of our code across Android and iOS, and we integrated with several SDKs for additional features, such as crash reporting, analytics, and barcode scanning.

We practice SCRUM, with daily standups and three week sprints. When we started we had in-house QA and a few offshore testers, who were essential to releasing a stable version to production. We use Atlassian JIRA for ticket tracking, GitHub/Bitbucket for version control, and created a Jenkins script to automatically send new builds to HockeyApp.

HockeyApp has been a huge help in diagnosing customer issues; we’ve been keeping a close eye on our crash reports to make sure the trend line bends down with each new release. We’re also taking advantage of HockeyApp’s user feedback functionality. Our customers can easily start conversations with our customer support team, and allowing them to upload screenshots not only helps with issue resolution, it makes for smoother customer support conversations.

Why did you choose Xamarin? Did you have in-house C# skills?

Simultaneously developing two apps in two different languages (one for Android and one for iOS) sounded like an unsustainable strategy, with never-ending management and maintenance hassles. So, we searched for a solution that would require only one codebase, which didn’t leave us with many options.

We evaluated a hybrid approach, where Ionic seemed like a good option, but we wanted native feel and performance. For me, native equates to a faster, more focused experience, tight integration with the operating system and device hardware, and overall higher user adoption and engagement.

With these requirements, Xamarin was the only viable choice. At first, we were a little nervous about Xamarin.Forms since it was still relatively new, but it proved itself able to do almost everything our UX team asked for (with the exception of certain animated transitions). We found the Xamarin.Forms architecture to be very intuitive; it allowed us to go from the initial requirements gathering and design stages to a full public release in just over a year, without any prior in-house native mobile development experience.

How did you get up to speed with cross-platform mobile development?

When we were building our initial prototype, the Xamarin Docs website gave us great information. Our developers signed up for Xamarin University later in the development process and found the instructors to all be top-notch. The app store build-related classes were particularly helpful, since you have to jump through a lot of hoops to get things packaged correctly and successfully published.

What is the most compelling or exciting aspect of your app?

Our customers love “saved searches,” especially for our used gear, since our used gear inventory is constantly being updated, and on the app they can easily define product search criteria and receive push notifications when new matches are available. This feature is one of the big differentiators from our website experience. We also just added responsive tablet views, where the UI switches to a two-column layout on wider screens. Expanding the existing app to also support tablets was an easy way to reach a wider customer base without the overhead of managing another codebase.

You have amazing reviews. Do you have a favorite?

User feedback has been overwhelmingly positive; we currently have a 4.5+ rating in both public apps stores.

A few reviews that stand out:

    Guitar Center app on iPhone

  • “My App! I don’t want to share! I feel this app gives me the ability to get secrets on guitars no one else knows about!! As an avid guitar player, I love the format and ability to search for what I want and love and even build a wish list. This is my secret app!!”
  • “Great app! This is definitely a ‘go to’ app for me. I’m always on the hunt for used gear and sales…..easy to navigate and constantly updated. Maybe Guitar Center oughta be in charge of all the .gov websites….great job GC!!!”
  • “Exactly what you’d want in a GC app. I had pretty low expectations, as store apps are usually terrible, but this isn’t the case. GC did a great job with this app! It has everything you’d want in a GC app, from daily deals to item notifications to a barcode scanner!” “Forget everything else. Downloaded the app, searched for the used guitar I had been looking for and couldn’t find anywhere, found it within seconds. Goodbye paychecks ;)”
  • “I write iPhone Apps for a living and also dig guitars and have 21 nice electric guitars. This app caters perfectly to my obsession and, in my opinion, is nicely done! What’s the coolest store ever? Guitar Center! If you do the work, you can sure get great deals and this app makes the work easier!”
  • “This app is phenomenal! I can save my searches and save my product alerts! Guitar Center, y’all have really took it up a level!”

What’s your team planning to build next?

We’re not quite ready to publicize our next big initiative, but it’s in the works. While we’re working on what’s next, we’ll also continue to release regular updates and minor changes to make sure our app experience aligns with our websites.

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

Before you start building out all of your apps’ various pages, invest time in building a solid code infrastructure. For us, that meant a lot of preliminary work with navigation handling, URL routing, authentication, creating shared view components and control templates, etc.

I’d also suggest using MVVM architecture, except for the most basic app pages. It’ll make your code more manageable, especially if you plan to switch views based on device type or operating system.

Lastly, keep in mind how you’ll handle different app versions being out in the wild at the same time, particularly if they call a common API. We built in a remote configuration system that allows us to recommend upgrades, update labels and images, and turn key features on/off, based on users’ current version number.

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

The post Guitar Center’s Five-Star Xamarin.Forms Apps Bring Music to the Masses appeared first on Xamarin Blog.

July 17

Introducing MFractor for Visual Studio for Mac

This is a special guest post from Matthew Robbins at MFractor. You can find him on Twitter at @matthewrdev.

Let’s say you’re a Xamarin.Forms developer and you’re starting out on a brand new app: a single screen, T-shirt ordering app. You’ve got the specs, the backend is mostly done, and all that’s left is for you to click File -> New Solution and get started. Exciting times!

We know that this is straight-forward for a Xamarin.Forms developer; we build our UIs in XAML to create native user interfaces that maximize shared code and use the MVVM pattern for our app logic ensuring good architecture and testabilty.

However, the development process can be made easier by using MFractor, a productivity extension for Visual Studio for Mac.

MFractor is a mobile-first refactoring tool for Visual Studio for Mac that contains a slew of features that are handy when building Xamarin apps. We can use MFractor to create view models, detect and fix XAML code issues, generate XAML code snippets, navigate easily through Android resources, and much more.

So, let’s make our T-shirt app and learn how to make our app development easier with the help of MFractor!

Making The App

We’ll start by creating a new project for our app, MyTShirt and adding some controls to our main page, MyTShirtPage.xaml.

  • An Image where our apps logo will sit.
  • A Label and Entry for our customers name.
  • A Label and Entry for our customers email address.
  • A Button our customer can click to order their t-shirt!

The XAML, complete with data binding, will look a little like this:

MyTShirt.xaml

<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:local="clr-namespace:MyTShirt"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="MyTShirt.MyTShirtPage">
    <Image />
    <StackLayout Orientation="Horizontal">
        <Label Text="Name: "/>
        <Entry Text="{Binding CustomerName}"/>
    </StackLayout>
    <StackLayout Orientation="Horizontal">
        <Label Text="Email: "/>
        <Entry Text="{Binding CustomerEmail}"/>
    </StackLayout>
    <Button Command="{Binding OrderTShirt}"/>
</ContentPage>

Easy!

But we’ve accidentally made a mistake in our XAML… Can you spot it?

We’ve put all of our controls directly inside the ContentPage instead of a view group such as a grid or stack layout. If we ran our app, we’d only see our image control! This is a common and easy-to-make mistake when creating a new screen that causes a hard-to-find runtime bug.

MFractor’s XAML analyzer detects this bug and marks it as a code warning directly inside our XAML editor. Now, instead of having to run our app to discover the bug, it’s clearly highlighted in the editor and we can hover over it to view the issue in detail:

This content page has multiple children.

MFractor also offers a solution to this issue; by right-clicking on the affected code and selecting Encapsulate content with StackLayout, we can wrap all of ContentPage‘s children with a stack layout to quickly resolve the bug:

Fixing the multiple children in content.

MFractor offers over fifty XAML code inspections that detect everything from missing controls to missing view model bindings to value conversion type flow issues.

By highlighting code issues in the editor, MFractor prevents issues from appearing at compile time or even worse, runtime. This saves us precious development time so we can spend time writing code instead of fixing bugs.

For more documentation MFractors XAML analysis, see:

Adding An Image Logo

Next, let’s add an image logo to our page by setting the Source property of our image.

Unfortunately, this image doesn’t yet exist in our iOS or Android project resources, so it wouldn’t appear when we run our app.

MFractor’s missing image inspection detects this bug. We’re told through code issues that the image is missing from our iOS and Android apps, and we can simply press Alt+Return on the issue to import the missing image!

Importing a missing image reference.

Too easy! We can also hover over the image reference and view our freshly imported image in MFractor’s image tooltip.

To learn more about MFractor’s image tooling for Xamarin.Forms, see:

Create Our View Model

Next, let’s create the view model for our page.

Instead of manually creating the view model class and then writing out our bindings, MFractor makes this dead simple.

Just right click anywhere in the XAML page and select Generate a new ViewModel for XAML view:

Generating a new view model from a page.

MFractor will check all data-bindings in the page, generate a new class named MyTShirtViewModel, and then implement all the data-bindings into the view model as public properties. It will even generate a command stub for the buttons OrderTShirt command!

MFractor will honor the Page and ViewModel naming convention when generating new view models. It will also consider the MyTShirtPage and MyTShirtViewModel associated through this naming convention.

Voila! In a very short amount of time we’ve built the shell of our T-shirt app, ready for the app logic to be written.

To learn more about MFractor’s view model tooling for Xamarin.Forms, see:

MFractor for Xamarin.Android and C#

MFractor isn’t just for Xamarin.Forms developers, you can also supercharge your Xamarin Native development with a suite of very useful tools for Xamarin.Android and C#.

For Xamarin.Android

Use resource tooltips to view in-depth information about a particular Android resource and then easily jump it:

Android resource tooltips and go-to resource.

You can also use Resource IntelliSense to build your resource files quickly:

Using MFractors Android Resource IntelliSense.

For C# (Premium Only)

Bulk create missing base class constructors:

Generating base class constructors.

Use the Android C# API code analysis to find tricky Android issues, such as missing views in a layout:

Android layout usage code inspection.

Get MFractor

Now I bet you’re wondering just how you can get MFractor for Visual Studio for Mac.

It’s simple! To access MFractor Lite for free, just download the MFractor.Installer app, run it, and activate MFractor using your email address:

Installing MFractor for Visual Studio Mac.

If you’d like C# tooling, advanced Xamarin.Forms tools (such as image analysis), or the ability to change the code MFractor creates, you can purchase an MFractor Professional license.

MFractor Professional is $299AUD per user per year; licenses can be purchased at https://www.mfractor.com/buy.

Summary

In this article, I’ve only started to scratch the surface of how MFractor can help you be a more productive Xamarin developer. There are still many useful tools you can use, including control importing, value conversion tooling, or generating XAML code snippets.

If you’d like to learn more about MFractor, reach out to me on Twitter, Slack, or viaemail.

Matthew Robbins, Creator of MFractor

The post Introducing MFractor for Visual Studio for Mac appeared first on Xamarin Blog.

July 12

Urban Refuge’s Refugee Aid Mobile Apps Turn Research into Action

Started by a group of Boston University students 2015, Urban Refuge uses technology to improve both urban refugees’ experience and humanitarian organizations’ ability to coordinate resources, making aid available via a centralized, easy-to-access database. Urban Refuge’s research found that simply making options available on a map on refugees’ personal devices dramatically increased the odds refugees would find and accept vital assistance.

Together with Microsoft Technical Evangelists, the Urban Refuge team translated their findings into Android and iOS apps optimized for refugees’ unique needs, from localization and graphic-centric UI to geo-tagging and social login. Today, we’ve invited Urban Refuge and their Microsoft Technical Evangelist partners, Gavin Bauman and James Sturtevant, to share how Microsoft technology, including Visual Studio Tools for Xamarin, Azure, HockeyApp, and Visual Studio Team Services, freed the team to focus on user experience, easily respond to user feedback, and prepare to scale to more communities.

Tell us a little bit about Urban Refuge’s mission and how you became involved.

[Urban Refuge (UR) Team]: Urban Refuge was born out of a class taught by Professor Lori at Boston University’s Pardee School of Global Studies. We were motivated to use our knowledge about the Syrian refugee crisis to create something practical to help refugees. When we discovered that, despite greater aid resources in cities, refugees experience lower access to aid in urban settings than in camp settings, we saw a problem that technology could solve.

Historically, organizations use expensive and time-intensive surveys to assess and allocate humanitarian aid, without sharing information across NGOs. As students, we didn’t want to write policy papers that would never get read, we wanted to use technology to design and build a digital infrastructure that could serve refugees and act as a conduit that connects local municipalities and NGOs.

No one in our class was a developer, but we quickly started learning about tools that could help us build our app.

[Gavin Bauman (GB)]: As Microsoft Technical Evangelists, our job is to help other developers deliver industry leading-applications and services. James has been developing software professionally for the last decade or so, and I got my start more recently (beginning in 2014, after my university computer science classes and spending my spare time developing Android apps for fun).

Urban Refuge
’s mission clearly aligns with Microsoft’s mission, “to empower every person and every organization on the planet to achieve more.” We’re in a unique position; we’re able to work with organizations to turn their visions into a reality and reach so many people in the process.

Urban Refuge on iPhone

Tell us about the app and what it allows users to accomplish.

[UR]: Urban refugees currently make up 78% of the 655,000 registered Syrian refugees in Jordan, particularly Amman. Research suggests that the majority of refugees have mobile devices, but they discover available assistance primarily via word of mouth.

We used this research to create an accessible, easy-to-use digital mobile platform that maps aid locations—places like charities, medical clinics, schools, and community organizations—for displaced persons and enhances the digital architecture of cities.

We designed our app to help as many people as possible. For example, we use more icons than text to make sure we’re not excluding anyone who’s illiterate and to avoid creating more translation work for us. Users click on an intuitive icon and immediately see all nearby services across categories (health, education, cash assistance, work, housing, etc.). Also, since streets aren’t very well marked in online maps for Amman, we’re geo-coding locations to provide directions to exact addresses.

[GB]: Refugees use Urban Refuge (Daleel Amman in Arabic) to reliably locate and navigate to aid facilities, without any stigmas associated with being a refugee. They simply open the app on their phones, choose their resource type, and Google Maps acts as the visual mapping element to show what’s nearby. We’ve also adhered to localization strategies, so the app reads well in Arabic and English.

Currently, we pull from a database of over 160 aid organizations and, going forward, the Urban Refuge team can just enter new organization or resource details in a web-based management portal, making it easy to add aid options and expand to more global refugee communities.

Why did you choose Visual Studio Tools for Xamarin? 

[GB]: Urban Refuge wanted to develop a solution that didn’t require maintaining multiple complex codebases and was available in Arabic and English. Xamarin.Forms allows us to do both, giving us performant, native UI controls that look like they were made for each operating system and that work the first time, every time.

[James Sturtevant (JS)]: Honestly, I wouldn’t have been able create an Android and iOS application without Xamarin; I would have spent weeks simply learning about two different platforms, two languages, and two different UI concepts. I was productive right away, without having to learn platform-specific languages.

Describe your development process.

Urban Refuge on Nexus[JS]: When I met the Urban Refuge team, they’d already done the majority of the design work; I helped flesh out technical details and then Gavin and I started working on the implementation.

After two and half weeks, we had a working end-to-end solution, including an ASP.NET Core backend to store and load aid, location, and refugee data. Azure was our first choice, mostly due to its scale and developer-friendly tooling. We used Azure App Service and Azure B2C for authentication to allow the Urban Refuge team to continue iterating in the future, confident that security and scale won’t be a problem.

Visual Studio Tools for Xamarin provided an easy-to-use, but flexible, abstraction with dependency injection. We share the majority of the UI and business logic across Android and iOS and for some components, like our Hockey App integration or localization implementation, we could write platform-specific code and still access it from our shared Xamarin.Forms code.

We set up our builds in Visual Studio Team Services. After the first week, we were deploying beta versions to the Urban Refuge team every few days. This was a great experience for them and for us as developers. Seeing the app as it was being developed gave Urban Refuge confidence that we were on the right track and creating the best app for their mission. As the UR team used the app, we used HockeyApp’s detailed reporting and stack traces to find and fix bugs that would’ve been very difficult to replicate and track down.

We moved quickly, since we were programming in C# and using familiar patterns, and Xamarin lowered the transition overhead between the backend and front end, making our iteration cycles extremely fast.

Urban Refuge on HTC

How are you testing your apps?

[UR]: Mobile quality is extremely important to us. It would be disastrous if we launched with a buggy app that crashed. Industry research shows that users have a low tolerance for apps that fail, so we’re investing time now to ensure we have the highest quality product possible. We’re about to start testing with a team of Syrian and Jordanian students, who are based in Jordan and working with Microsoft technical evangelists from the Amman office. They’ll help us run one (or more) beta rounds as we prepare for the full launch.

This beta testing phase is critical for making sure our app works well in a variety of settings. For example, we want our maps to load once and be available offline, allowing our users to find help and get directions, even when they don’t have internet access. We’ll use our test phase data to determine what changes we need to make our roll-out.

Why did you select HockeyApp? What were you trying to accomplish?

[GB]: Knowing how users actually use the application will help the Urban Refuge team ensure they’re surfacing enough available assistance opportunities, so we’ve instrumented the apps with HockeyApp. We’re anonymously collecting data every time a user selects a filter (e.g. aid of a given type), and this detailed telemetry will allow the small team to prioritize and focus their resources on what’s most important.

Since the Urban Refuge team is distributed, including its Amman beta testers, we’re also using HockeyApp to automatically deploy new builds to test groups.

How are you incorporating beta feedback into your production release?

[UR]: We have a multi-phase plan for gathering and incorporating user feedback. We started in March 2017, when we asked potential users (refugees, Jordanians, and NGOs) to provide input on our icon design and other app features. We made changes and we’re currently in the second phase where Syrian and Jordanian student teams in Amman will continue to provide feedback throughout the beta testing period. For our production release, we’re building a reporting mechanism into the app, which will allow users to provide feedback directly to our developers and helping us improve (for example, flagging a resource with incomplete or inaccurate information).

What’s your team planning to build next?

[UR]: After we launch in Amman and have a clear idea of refugees’ response, we plan to expand to other cities in Jordan. Eventually, we’ll grow to other regions in the Middle East, and we’d like to create a similar app for Boston residents.

Our long-term goal is create an “early warning system” for social resource providers and state agencies. Ideally, the usage data from our apps will help accurately predict optimal resource allocation and identify social epidemics, such as housing instability, joblessness, or lack of available childcare, based on increased demand (or searches) for those aid types.

What advice do you have for developers who are just starting out or investigating mobile development? Any best resources?

[GB]: I was a beginner not too long ago, and the best advice I can give is to have a clear vision of what you want to do. The worst thing a new developer can do is code “blind.” Start your development process with a pen and paper and sketch out what your solution will look like before you start building anything.

This is rare for me to say, but the Xamarin documentation is nothing short of awesome. There’s plenty of recipes to get you up and running quickly with things you haven’t touched yet, and Xamarin University classes helped round out my mobile development skills. We also took advantage of some great Continuous Integration blog posts for Android and iOS to implement our automated build pipeline.

Finally, it never hurts to have a mentor that can help you dig your way out of a hole!

Watch Urban Refuge’s story here to learn more.
 
 
Visit xamarin.com/download to get started and explore xamarin.com/customers to get inspired.

The post Urban Refuge’s Refugee Aid Mobile Apps Turn Research into Action appeared first on Xamarin Blog.

July 11

Mastering the Android Support Libraries

Android Support Libraries are an essential part to every Android application and you’ll find them absolutely everywhere. The Support Libraries offer developers the ability to add the latest and greatest features of Android to their application, while maintaining backwards compatibility with older versions of Android. As new versions of the Android SDK continue to roll out, so do updates to the Support Libraries; keeping them up-to-date and installing the correct versions is an important (and sometimes frustrating) part of Android development. In this blog, I hope to demystify the Support Libraries and help you upgrade to the latest versions

Versioning

The first thing to understand is how Support Libraries are versioned. I discussed this topic on the Xamarin Podcast with Jon Dick a few weeks back, but here’s a quick breakdown: every Support Library NuGet has a semantic version number (Major.Minor.Patch) that matches the revision of their java counterparts, so you can always see what’s in each release by browsing the revision history. Sometimes you’ll see an additional fourth patch number at the end signifying bug fixes to the NuGet. As of this blog, version 25.3.1 is the latest stable NuGet that Xamarin developers have access to. The most important number to take away is the Major version number of 25. This number signifies that it was built against Android SDK API Level 25 and means that to install this NuGet and use it properly, you must choose API 25 or higher to compile against inside of Visual Studio, otherwise you may see this error:

Could not install package ‘Xamarin.Android.Support.Compat 25.3.1’. You are trying to install this package into a project that targets ‘MonoAndroid,Version=v7.0’, but the package does not contain any assembly references or content files that are compatible with that framework.

Updating Support Libraries

Now that we have a full grasp on Support Library versioning, we can update our existing libraries to the latest versions. At this point you may be wondering why you need to update your libraries. As time goes on, the Support Libraries add new features, but also offer several bug fixes that apps need. In addition, you may be taking dependencies on other libraries such as Google Play services or Plugins for Xamarin, which may have been built against the latest support packages. In fact, recognizing that now is the time to update, I recently updated all of my Plugins to target .NET Standard and the latest support libraries.

Step 1: Install Android SDK 25

To be able to compile against API 25 as I showed above, you’ll need to install the Android SDK for API 25. Under Tools->Android->Android SDK Manager… you’;l find the SDK Manager to update to API 25. The first thing to do is make sure you “deselect all” and find the SDK Platform 25 under Android 7.1.1. You should have one package to install. (If using Visual Studio for Mac, read through our guide on the new SDK Manager).

After installation we’ll need to select to compile against this SDK:

Additionally, it’s best practice to also set our target to the same version as the compile version.

At this point, it’s highly recommended to close and re-open your solution. This ensures that all of your settings are synced and ready for NuGet to kick into action. You’ll see an error when upgrading that you aren’t targeting the correct version of Android if you don’t set the compile targets correctly and they haven’t taken effect.

Step 2: Updating NuGets

Now it’s time to update the Support NuGets. It’s extremely important to update ALL of the support libraries that you have installed. Failure to do so will lead to mismatched versions and compilation errors. Right-click on your Android project and select “Manage NuGet Packages…” In the update tab you’ll see a list of Support Libraries to target. Simply select all packages and hit “Update”.

This ensures that all NuGets and dependencies get updates. You may be prompted to close and re-start Visual Studio; ensure that you do this so the projects are fully updated.

If you’re using Visual Studio for Mac, you’ll see updates for the NuGets in the Packages node of your project. You can update them one at a time or right-click on the Packages node and update all.

After updating, I always like to double check that ALL of the packages have been updated by closing the solution and opening it again and repeating Step 2. After this is done, make sure you perform a full Clean and then Rebuild of your project.

There you have it, your Support Libraries are up to date and ready to go!

Video Walkthrough

Want to see it in action? I recently walked through the upgrade path on The Xamarin Show on Channel 9 with plenty of tips and tricks along the way:

The post Mastering the Android Support Libraries 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