April 15, 2014

C# Meetups featuring Google Glass, Bluetooth LE & More

By

Community growth continues to be explosive with new Mobile .NET developer groups starting all over the world. This month, we have already seen the inaugural meeting for a new group in Paris, France, and we are pleased to announced two new groups in Tampa Bay, FL and Madison, WI! So, April isn’t over yet as it packed full meetups happing everywhere on vast topics from MvvmCross, Intro to Xamarin, and Bluetooth LE!

Mobile .NET Developers Meetups April 2014

Here are some upcoming Xamarin developer group meetups:

New Group: Tampa Bay Xamarin User Group usa flag

  • Tampa Bay, FL: Wednesday, April 16th 7:00PM
  • First TBXUG Meeting – Intro to Xamarin

Boston Mobile C# Developers Group usa flag

  • Cambridge, MA: Thursday, April 17th 6:30PM
  • Developing for Google GlassChris Hardy, Xamarin

.NET BC canada flag

  • Vancouver, BC: Tuesday, April 22nd 6:00PM
  • Cross Platform Mobile Development for the C# Developer with XamarinJames Montemagno, Xamarin

New Group: Madison Mobile .NET Developers Group us

  • Madison, WI: Wednesday, April 23rd 5:30PM
  • Introduction to Xamarin

Dutch Mobile .NET Developers Group Netherlands flag

  • Aalsmeer, Netherlands: Thursday, April 24th 6:00PM
  • Responsive design and Bluetooth LE

Vancouver .NET Mobile Developers Group Canada

  • Vancouver, BC: Thursday, April 24th 6:30PM
  • Mobile Development Techniques using C# and MvvMCross

Detroit Mobile .Net Users Group us

  • Southfield, MI: Monday, April 28th 6:00PM
  • Build / Xamarin Recap, Humanitarian Toolbox

Sydney Mobile .Net Developers Group Australia Flag

  • Sydney, Australia: Tuesday, April 29th 6:30PM
  • Build 2014 and Cross Platform Visual State Management

If you don’t see your city listed above, don’t worry as new events and developer group meetups are being added frequently on the Xamarin Events forum.

If you are interested in starting a developer group in your city we are here to help you get started. We have tips and trick on staring a developer group, a brand new introduction to Xamarin slide deck, and of course our community sponsorship program to get you on your way. We also want to hear from you so please feel free to send us an email or tweet @XamarinHQ so we can help spread the word and continue to grow the Xamarin community.

TwitterFacebookGoogle+LinkedInEmail
April 10, 2014

Xamarin Evolve 2014 Registration Now Open

By

Untitled-1We are very excited to announce the opening of registration for Xamarin Evolve 2014, our worldwide developer conference! Join us and fellow developers from October 6-10 in Atlanta, Georgia for the largest cross-platform mobile development event of the year!

Even Bigger!

This year, we’re doubling capacity and adding an extra day of conference sessions to make room for more great content covering mobile development with C#, Visual Studio, and Xamarin Test Cloud. Evolve sessions will cover a range of topics, including game-changing Xamarin product announcements by Nat and Miguel, best practices in mobile user experience design, advanced cross-platform techniques, memory management, real world app case studies from leading companies, secure data integration, lightning talks and so much more.

World-Class Training

Xamarin University LogoAttend two days of training from Xamarin University spanning all topics from mobile development fundamentals to advanced areas such as security and code-sharing strategies.

Learn from Mobile Experts

Over the course of three days you will have the chance to attend an immense amount of live sessions covering all areas of mobile development by industry leaders and experts. The entire Xamarin engineering team will be on-hand for one-on-one mobile coaching to answer questions, debug code, and provide advance.

Xamarin Evolve Welcomes Top Sponsor, Microsoft

We are also delighted to announce today that Microsoft will be joining Evolve 2014 again as our sole Platinum Sponsor. In recent months, Xamarin and Microsoft have partnered globally to help developers build great apps with C#, Visual Studio, and Portable Class Libraries, and this past week, Xamarin joined with Microsoft to launch the .NET Foundation. Together, Xamarin and Microsoft bring C# to 2.6 billion devices, and together we will make Xamarin Evolve 2014 an event you won’t forget.

MicrosoftSponsorEvolve2014

Registration Now Open

Tickets for Xamarin Evolve 2014 our second worldwide developer conference, are officially available for purchase today.

Register Now

Team Xamarin

TwitterFacebookGoogle+LinkedInEmail
April 9, 2014

Swipe To Refresh added to Android

By

Swipe-to-Refresh animation

Google recently released an update to the Android support library bringing in an exciting new standard implementation of a pattern that they have been progressively introducing through applications such as GMail or Google Now.

This pattern, called swipe-to-refresh, uses an upward pull user feedback to inform the app that a data refresh is requested. This complete another common pattern, infinite scrolling, that instead use a downward movement to load more data.

We have updated our component to expose the new SwipeRefreshLayout class that implements the pattern. To make use of it, simply wrap in your existing Xamarin.Android app layout.

<android.support.v4.widget.SwipeRefreshLayout
    android:id="@+id/refresher"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>

Setting up the SwipeRefreshLayout instance is pretty easy from code. You simply have to define a color scheme and a callback that is invoked when an update operation is requested by the user.

refresher = FindViewById<SwipeRefreshLayout> (Resource.Id.refresher);
refresher.SetColorScheme (Resource.Color.xam_dark_blue,
                          Resource.Color.xam_purple,
                          Resource.Color.xam_gray,
                          Resource.Color.xam_green);
refresher.Refresh += async delegate {
	await forum.FetchItems (clear: true);
	refresher.Refreshing = false;
};

The color scheme can be any set of color or the same color. In any case, the first parameter is also used as the initial feedback bar background.

We have also added a dedicated sample that shows how this code can be integrated in a complete scenario, including a complex layout utilizing fragments.

TwitterFacebookGoogle+LinkedInEmail

OpenSSL “Heartbleed” Update

By

You might have read by now that details of the “Heartbleed” OpenSSL vulnerability were published earlier this week. For those that don’t already know, OpenSSL is a popular, general purpose cryptography library in wide use across the internet. Like nearly every company on the internet, we immediately took audit of our systems, and uncovered some systems using a vulnerable version of OpenSSL. We immediately began updating all Xamarin services that were affected, and as of Tuesday afternoon, no Xamarin systems are subject to this vulnerability.

We have also reissued all HTTPS certificates for all xamarin.com domains with new encryption keys, and have had the previous versions revoked by our issuer, which was also completed Tuesday evening. At this point, we believe that it is extremely unlikely that any of our systems were compromised before we patched OpenSSL; however, for an additional layer of security, we recommend that you take the following steps to safeguard your Xamarin account — especially if you used the same password for your Xamarin account as on other accounts hosted elsewhere:

  1. Sign out of your Xamarin account and then sign back in (you’ll want to do this in the IDE as well)
  2. Change your Xamarin account password

At Xamarin we are committed to your security and privacy. We are continuing to track the issue closely and will keep you up to date if anything new is discovered. For more information on this OpenSSL vulnerability visit www.heartbleed.com

TwitterFacebookGoogle+LinkedInEmail

C#, iOS, and Android Take Center Stage at Build

By

It was an exciting week for .NET developers with a slew of announcements at this years Build conference in San Francisco.

Microsoft Build Sign

The most anticipated Build session of the week hands down was Miguel’s “Go Mobile with C# and Xamarin”, where over 1,500 developers packed the main hall for a chance to see Miguel talk on the transformation of mobile development. The audience loves seeing his live coding session where he used iOS’ CoreImage and Twitter integration to add Sepia filter to an image and tweet it out to the world!

Packed house at Miguel de Icaza's build talk

Continuing to wow the crowd, Miguel unveiled our brand new Xamarin T-shirt Store app enabling developers to try out Xamarin to build their first app to order their very own limited edition C# shirt that he was rocking on stage.

A major highlight of the week was when C#’s lead architect, Anders Hejlsberg, open sourced the .NET Compiler Platform, Roslyn, live on stage. This marked a major milestone allowing developers to gain access to a plethora of information that compilers have about the code we write each day. Immediately after Anders open sourced Roslyn, our own Miguel de Icaza hit the stage to showcase the power of an open sourced Roslyn by compiling code with a modified version of Roslyn running on Mono inside of Xamarin Studio on a Mac!

If Roslyn wasn’t enough, Xamarin took part in the official launch of the .NET Foundation. This new foundation will foster open development, collaboration and community engagement on the .NET platform. Xamarin initial contribution consists of six open source .NET Projects including Mailkit, Mimekit, System.Drawing, and more! We are excited to join other community leaders including Laurent Bugnion, Niels Hartvig, Paul Betts, and other to aid in advancing .NET open source projects..NET Foundation

The excitement for Xamarin, C#, and mobile apps continued throughout the week with an always packed Xamarin booth. Thousands of developers got to chat and get a hands on demo of creating beautiful Android and iOS apps in C#.

Packed Xamarin booth at //Build/

Build wouldn’t be complete without an epic Xamarin party, and this year was no different. Our friends .NET joined us to co-host a mega party in downtown San Francisco. Thousands of developers packed in to get face time with Nat, Miguel, Joseph, and the rest of the Xamarin crew at a party that is not to be forgotten! We want to thank everyone that was able to stop by the party and booth.

Xamarin Build Event at Mezzanine

If you thought that Build was epic, you will absolutely want to join us for Xamarin Evolve, the largest mobile developer conference of the year. Tickets go on sale on April 10th, so make sure to visit the official Evolve website to sign up for details.

TwitterFacebookGoogle+LinkedInEmail
April 8, 2014

Native Printing with Android

By

The latest version of Android, KitKat, adds long-awaited printing support to the platform. Android applications can now provide low-level control of print jobs, in addition to print integration for applications incorporating web content. This makes KitKat particularly well-suited to hybrid applications built with Xamarin using Razor templates.

Android KitKat Printing

Printing with a WebView

First let’s look at the easy to use print support offered through the WebView control.

Printing requires 3 steps:

  1. In an Activity, get a reference to the PrintManager system service.
  2. Create an instance of a class that inherits from PrintDocumentAdapter.
  3. Call the PrintManager‘s Print method, passing it the print adapter.

The PrintDocumentAdapter is an abstract class that provides a contract to implement for supplying print content. For web content, the WebView class includes a PrintDocumentAdapter, making printing HTML from a WebView incredibly easy to do:

The following example shows a WebView built using the Android WebView template, which uses Razor as an HTML templating engine:

Android Printing from a Xamarin Razor Template

Although printing can be done using any WebView, integrating printing with Razor and this project template makes it really easy to build a hybrid application that can leverage native features such as KitKat printing.

Printing from the WebView with C# is as simple as adding these 2 lines of code in the activity:

var printMgr = (PrintManager)GetSystemService(Context.PrintService);
printMgr.Print("Razor HMTL Hybrid", webView.CreatePrintDocumentAdapter(), null);

When we call Print Android presents a system dialog, allowing the user to choose the print destination, as shown below:

Android Print Dialog

Custom Print Adapter

To print from native Android views, taking low-level control of the print layout, we can implement our own PrintDocumentAdapter.

For example, let’s say we would like to print the layout from the following screen:

Android Print Activity Low Level

In our implementation of PrintDocumentAdapter, the required methods to implement are:

  • OnLayout – Allows laying out print content based on the PrintAttributes.
  • OnWrite – Allows writing a PDF file with content to print.

In OnLayout, we create a PrintDocumentInfo instance, which contains metadata about the document being printed.

public override void OnLayout (PrintAttributes oldAttributes, PrintAttributes newAttributes,
                               CancellationSignal cancellationSignal, LayoutResultCallback callback, Bundle extras)
{
  document = new PrintedPdfDocument (context, newAttributes);
  CalculateScale (newAttributes);
  var printInfo = new PrintDocumentInfo
    .Builder ("MyPrint.pdf")
    .SetContentType (PrintContentType.Document)
    .SetPageCount (1)
    .Build ();
  callback.OnLayoutFinished (printInfo, true);
}

In OnWrite, we implement the code to draw printed content and write it to the output stream to be printed.

public override void OnWrite (PageRange[] pages, ParcelFileDescriptor destination,
                              CancellationSignal cancellationSignal, WriteResultCallback callback)
{
  PrintedPdfDocument.Page page = document.StartPage (0);
  page.Canvas.Scale (scale, scale);
  view.Draw (page.Canvas);
  document.FinishPage (page);
  WritePrintedPdfDoc (destination);
  document.Close ();
  document.Dispose ();
  callback.OnWriteFinished (pages);
}

Printing with our custom adapter is just like using the WebView‘s adapter. Simply pass an instance of the custom adapter, called GenericPrintAdapter in this case, to the PrintManager‘s Print method:

var printManager = (PrintManager)GetSystemService (Context.PrintService);
var content = FindViewById<LinearLayout> (Resource.Id.linearLayout1);
var printAdapter = new GenericPrintAdapter (this, content);
printManager.Print ("MyPrintJob", printAdapter, null);

When the user clicks print, the same system dialog is displayed. In addition to a local printer, you can select Google Cloud Print or print to a PDF file, resulting in the print shown below:

Android Printed to PDF

The printing support added to KitKat is a much welcome feature that is easy to get started with. You can download the code used in this post from my GitHub repo.

Discuss this post in the Xamarin forums.

TwitterFacebookGoogle+LinkedInEmail
April 7, 2014

Sennheiser Cuts Development Time by 40% with Xamarin

By

SennheiserlogoSennheiser is a world leader in quality audio experiences.  The company recently launched Sennheiser TeamConnect, an end-to-end enterprise-grade meeting solution that integrates speakers, microphones, and a central control unit.  When it came to the central control unit used by employees to remotely control the telephone line and audio levels of TeamConnect, the company sought simplicity for the product’s user interface.

Rather than creating a physical control panel, the company decided to put the controls into the user’s hands via an iOS app for iPads and iPhones.

Dirk Eismann, the main developer on the project had experience using Apache Flex, PhoneGap, and pure Objective-C for iOS development, but this was the first Xamarin project for him.

Screen Shot 2014-03-24 at 11.27.41 AM

“I knew that Xamarin’s performance advantages over other cross platform tools and its rock-solid support for all of the iOS APIs were just what this project needed.“ Eismann says.

With a long background in Java, and a familiarity with C#, Eismann found it easy to make the transition to Xamarin, and completed the application code within just 6 weeks.

“Xamarin makes it surprisingly easy to do native mobile development,” Eismann says. “I especially liked how concepts common to .NET developers like events and delegates are added on top to the iOS API. This greatly simplifies development for anyone who has worked with .NET code.”

Download the full case study to learn more about the benefits Sennheiser has enjoyed from using Xamarin—including 40% faster development time, precisely mapped APIs, ease of use, and the ability to share code across platforms.

View the Case Study

TwitterFacebookGoogle+LinkedInEmail
April 3, 2014

Xamarin and Microsoft Launch the .NET Foundation

By

dotnet_logoIt has been an amazing day today. Not only did I have the opportunity to share the stage with the creator of C#, Anders Heljsberg, in the Microsoft Build 2014 day 2 keynote, but we also jointly announced with Microsoft the launch of the .NET Foundation, a newly created entity that will foster open innovation on .NET.

Xamarin contributed six projects to the foundation, and we are excited to be working with Microsoft as we take .NET in this new direction.

Miguel on stag with C# shirt

Microsoft contributed Roslyn to the Foundation, and on stage we demoed Roslyn working on a Mac with the iOS version of our new Xamarin Store App – a beautiful, native app that let’s C# lovers order their own limited edition C# t-shirt for free.  This demo was a great proof point for how open source will help get .NET everywhere.  We are very busy integrating the best bits of Roslyn into our technology stack.

Xamarin is contributing six projects to the .NET Foundation:

  • Xamarin Mobile: a library that exposes a single set of APIs for accessing common mobile device functionality across iOS, Android, and Windows platforms.
  • Xamarin.Auth: A cross-platform API for authenticating users and storing their accounts.
  • Couchbase for .NET: A lightweight, document-oriented (NoSQL), syncable database engine.
  • Xamarin’s System.Drawing:our cross-platform implementation of the familiar drawing API
  • MailKit and MimeKit: robust cross-platform email libraries optimized for mobile.

The .NET Foundation will help accelerate the adoption of .NET across every platform and computing form factor—servers, mobile devices and desktops, and we are very excited for Xamarin to be a part of it.

Check out the Build website to see the recordings of the Day 2 keynote. Tomorrow you should also be able to see a recording of my ”Go Mobile with Xamarin and C#” session.

Miguel and Anders on Stage at build

TwitterFacebookGoogle+LinkedInEmail

Look Sharp in a Xamarin C# Shirt

By

Just a few minutes ago in the Microsoft Build Day 2 keynote, Miguel de Icaza, Xamarin cofounder and CTO, unveiled the new Xamarin T-Shirt Store app available for iOS and Android. The app is a beautiful example of native apps written in C# and Xamarin.

sharp-shirt-web-FINAL@2xThe app is also your fastest path to getting one of our widely popular C# shirts, as modeled here by Xamarin San Francisco employees.

Follow these instructions to get your shirt, and then tweet a C#-shirt-wearing selfie to @xamarinhq to show your support of C# everywhere!

TwitterFacebookGoogle+LinkedInEmail
April 2, 2014

Miguel’s “Go Mobile With Xamarin” Session at Build

By

Microsoft Build just kicked off to a great start, and we were incredibly honored to be highlighted in the Day 1 keynote. There is a lot more Xamarin goodness happening at Build.

4.16.Keynote-8 (1)Xamarin CTO and cofounder Miguel de Icaza will be on stage tomorrow showing how you can “Go Mobile with C# and Xamarin”.  This talk shows how today’s mobile landscape plays to the strengths of C#, and will explore the possibilities for you as a .NET developer, as .NET emerges as the best platform for all devices.

According to the Microsoft Build agenda builder, this will be a standing room only session, so come early.

If you can’t get into the session, you can still catch up with Miguel, Nat, me and the rest of the Xamarin team at our joint party with Microsoft tonight.

When:  Wednesday, April 2, 2014 at 8:30pm
Where:  Mezzanine — 444 Jessie Street, San Francisco, CA 94103

RSVP

Feel free to bring along a sidekick—you don’t have to be a Build 2014 attendee to party with us.

Tweet about the party using the #Xamarin and #Bldwin hashtags and you’ll be entered into a drawing to win Xamarin Evolve 2014 tickets!

TwitterFacebookGoogle+LinkedInEmail