September 16, 2014

Xamarin Evolve 2014 Speaker Spotlight: Paul Betts

By

This is the fifth post in our Xamarin Evolve 2014 “Speaker Spotlight” series, helping you get to know a little bit more about some of the amazing speakers who will be contributing at this year’s conference.

Photo of Paul BettsPaul Betts is a C# Hacker at GitHub, and the author of several open source .NET projects, including Refit, Splat! and Akavache. Paul graduated from The Ohio State University, and likes to spend his spare time hacking on open source software, playing guitar and bass, and in general is within ε of really awesome.

How long have you been doing mobile development?

My interest in mobile development started when iPhone first released their non-web SDK, but I really got started in mobile development when I added Xamarin support to ReactiveUI, which was about two years ago.

What are your favorite mobile apps and why?

My favorite app these days is Dropbox’s Mailbox. The usability designers who created that app are absolutely brilliant; while I don’t find it to be a particularly visually beautiful application (so much white everywhere!), using it is an absolute joy. If you’re building any kind of content-management/TODO app, study this thing like a graduate student.

What is your favorite platform to develop for and why?

Android!

quotation markTHERE’S SO MUCH COOL STUFF YOU CAN DO ON ANDROID (WITH SOME WORK!) THAT YOU SIMPLY CANNOT DO ON iOS OR WP. WHILE IT’S SOMETIMES MORE FRUSTRATING TO WORK ON ANDROID, AND INVOLVES SOME PSYCHIC POWERS TO GET INTO THE HEAD OF THE GOOGLE ENGINEER THAT DESIGNED THE COMPONENT, THE SCENARIOS THAT ANDROID SUPPORTS ARE FAR MORE VARIED. ANDROID IS THE NEW RASPBERRY PI: YOU CAN INSTALL A TINY ANDROID DEVICE ANYWHERE!

What devices are you carrying around with you right now?

The devices I carry around with me are usually:

  • An HTC One (M7) – It’s getting a little long in the tooth, but getting the Developer Edition meant that it was super hackable and easy to flash with the latest software, given a bit of adb and fastboot work. It’s a great device except for the camera.
  • LG G Watch – I couldn’t wait until the Moto 360 came out – I’m excited to see if I can come up with a cool watch app!
  • nVidia Shield – It’s an Android phone with a super-powered graphics chip and an HDMI out, bolted to a game controller. I use it to play old SNES games and write software for it.

What are your favorite open source libraries, and why?

My favorite libraries? The Xamarin ones I write, of course! I’ve got a lot of them:

The common theme around most of these libraries is that they let you write cross-platform code in a Portable Library, and the library handles the platform details. For example, ModernHttpClient brings the best platform-specific networking libraries to your app, but wraps them in a familiar HttpClient interface that works everywhere.

Separate from that, I love all of the great work that Jake Wharton does; he’s a great Android developer and a lot of my library ideas come from him.

What is your favorite line of code that you have ever written?

My favorite line of code I’ve ever written is here.

To explain it though, I need to back up. The goal of this class is to provide a mapped operation queue – i.e. you schedule a Task with a specific Key – Tasks with different keys run in parallel, and Tasks with the same key run sequentially.

The entire behavior of this class, this complex notion that would take pages and pages of buggy, unverifiable threading/locking code, is reduced to a single (relatively) beautiful statement in C# with Rx. What’s even cooler, is that the notion of scheduling priority (i.e. important operations should go to the head of the line), was added simply by changing a data structure, from using a normal Queue in a SemaphoreSubject, to using a PriorityQueue.

If you missed the earlier posts in this series, click through to read about Jesse Liberty, Jon Skeet, Jonathan Peppers, and Laurent Bugnion.

TwitterFacebookGoogle+LinkedInEmail
September 15, 2014

Web Series: Better Know a Xamarin

By

You may have met a Xamarin or two at Evolve, developer group, or at one of our other awesome events. However, there are many Xamarins working hard behind the scenes and out in the field around the world to bring you this amazing development platform. Better Know a Xamarin is a new web series that you can find on our YouTube Channel, where we sit down with our fellow Xamarins to see what they do here at Xamarin and what their passions are.

BetterKnowAXamarin

To kick things off, we have four episodes for your enjoyment. So sit back and get ready to Better Know a Xamarin.

Morgan Forsythe - Marketing Operations Manager

Jon Goldberger – Customer Support Engineer

Aaron Bockover - Mac Team Lead

Alex Soto - Software Engineer (Components)

The web series will continue to roll out new videos each week, so be sure to follow our Twitter account or subscribe to our YouTube channel for updates. If you’re interested in joining our growing global team, check out our available positions here.

Want to better know a Xamarin in person? Meet us in Atlanta, Georgia for Xamarin Evolve, October 6th-10th. Register for your ticket to mobile expertise here.

TwitterFacebookGoogle+LinkedInEmail
September 12, 2014

Webinar Recording: Get Ready for iOS 8

By

On September 17th, iOS 8 will launch with over 4,000 new APIs, making it one of the largest iOS releases ever. Xamarin developers can start building for iOS 8 now, with support currently in the alpha channel for App Extensions, TouchID Authentication, PhotoKit, HealthKit, HomeKit, Apple Pay, and more.

In this webinar, Xamarin Developer Evangelist Mike Bluestein provides an overview of the top new and updated APIs, and how to incorporate all of the great new features into your app.

Download the slides for the Get Ready for iOS 8 Webinar here.

Additional Resources

To ensure you get the most out of the exciting changes in iOS 8 using Xamarin and C#, we’ve created an extensive set of resources to help you get started that are outlined in this blog post.

If you’re already registered for Xamarin University, we’ll be debuting a new class on September 17, 2014, that will help you update your apps for iOS 8. If you’re not already registered for Xamarin University, you can learn more about our unlimited, live mobile app development training here.

Lastly, if you are coming to Xamarin Evolve 2014, we will be covering iOS extensively, including iOS 8. If you are not already attending the conference, you can register here.

TwitterFacebookGoogle+LinkedInEmail
September 11, 2014

Xamarin Evolve 2014 Speaker Spotlight: Laurent Bugnion

By

This is the fourth post in our Xamarin Evolve 2014 “Speaker Spotlight” series, helping you get to know a little bit more about some of the amazing speakers who will be contributing at this year’s conference.

Photo of Laurent BugnionToday we’re getting to know Laurent Bugnion, the Senior Director of IdentityMine in Zurich, Switzerland. This year will mark his 8th year as a Microsoft Client Development MVP and his second year as a Microsoft Regional Director. He is also the author of the well-known open-source framework MVVMLight for Windows Phone, Windows 8, WPF, and Silverlight. In his free time, Laurent writes for MSDN Magazine and various other publications, as well as on GalaSoft, his blog. Be sure to see Laurent at Xamarin Evolve giving the talk, “Building Cross-Platform Applications with Xamarin, Xamarin.Forms and MVVM Light.”

Why did you get into software development?

I was an electric engineer and started doing low level coding for embedded controllers twenty years ago.

quotation markI GOT HOOKED – I JUST LOVE CODING AND SOLVING PROBLEMS. THERE IS AN AESTHETICS TO BEAUTIFUL CODE THAT IS REALLY APPEALING TO MY CREATIVE SIDE.

How long have you been doing mobile development?

I started doing programming about 20 years ago and worked on all kind of systems, from embedded controllers to full blown PCs. I am still coding for multiple systems and mobile is, of course, an important part of it. I did some code for the Palm line of devices, but it was more of a hobby. I really started coding professionally for mobile devices when Microsoft released the first Windows Phones.

What is your favorite platform to develop for and why?

After working on many different platforms, I would say that my favorite remains the various XAML/C#. I am able to create UI in XAML that I cannot easily create with other platforms, and XAML/C# is available for many devices, from TVs (XBOX) and phones to computers and tablets. Also the tooling (especially Blend) is just fantastic, especially when you work closely with designers (which I do). Of course, on Android and iOS without XAML, working with C# is nice, too, but I do find the UI on these platforms quite complicated to build for compared to the simple beauty of XAML.

What devices are you carrying around with you right now?

I carry the Nokia Lumia 1020, which is my most trusted companion, all the time. I love this device, especially the amazing pictures it takes, and the large screen.

I also usually carry my Kindle Paperwhite. I love to read and the reading comfort is just fantastic on this device, though I also read on my Lumia when I don’t have my Kindle with me.

I recently fell in love with a Dell Venue Pro 8, on which I installed Windows Pro 8.1. It’s an awesome little device where I can run any Windows application, including legacy ones, and has great battery life.

Finally most of my work is done on my Surface, and I cannot wait to get my new Surface Pro 3 at the end of August!!

What are your favorite mobile apps and why?

I love geolocation, and it still feels somehow magical when an app knows where I am. This can be a huge help, especially when traveling. Also, anything related to photography.

What will attendees get out of your talk?

Users of MVVM Light on Microsoft platforms love it because it isn’t overly complicated and “does the job”. Now, with the possibility to use MVVM Light on Xamarin, too, I want to build a knowledge base for new users. Some of them have never heard of MVVM, some of them know of it but have heard contradictory statements. There is a need for information, and this will help people to switch platforms more easily, as well.

If you missed the earlier posts in this series, click through to read about Jesse LibertyJon Skeet, and Jonathan Peppers.

TwitterFacebookGoogle+LinkedInEmail

Android L and So Much More Webinar

By

The Android L Developer Preview introduced a plethora of new APIs for developers to take advantage of, including Material Design, notifications, and new animations, to name a few. l-dev-prevXamarin developers can already access these new APIs right now with our recently announced preliminary support in Xamarin.Android. With Google expected to release Android L fully this fall, it will be increasingly important to take advantage of these new APIs and get your app up-to-date.

Join Developer Evangelist James Montemagno on Tuesday, September 16th at 8am PDT to walk through the top new and updated APIs in the release. In addition to everything new in the Android L Developer Preview, he will also cover everything new in the Google Play Services, Support Libraries, Android Wear, and Android TV SDKs.

Register Now

TwitterFacebookGoogle+LinkedInEmail
September 10, 2014

iOS 8 Bigger and Better with Xamarin

By

We are excited to announce that we have just released our support for all of the new APIs introduced in iOS 8.

We have added support for the just-announced Apple Pay API, so developers can integrate this new payment system into their iOS apps, continuing our streak ofios8-icon shipping same day support for iOS since iOS 5 and enabling developers to add the latest features to their iOS apps immediately.

This release is the perfect companion to the iOS 8 GM developer release so you can start submitting apps to the App Store that take advantage of the new iOS 8 APIs.

To ensure you get the most out of these exciting changes in iOS 8 using Xamarin and C#, we’ve created an extensive set of resources to help you get started:

iOS 8 Samples

First off we have plenty of new iOS 8 samples that provide examples of using updated iOS features in Xamarin and C#

App Extensions

app-extensions-iconExtensions allow applications to deliver functionality throughout the system. Applications can now offer such things as today widgets that live on the notification screen, custom keyboards and sharing extensions to name just a few of the new ways to reach beyond the application itself.

TouchID Authentication

touch-id-iconTouchID allows applications to tap into the authentication capability of Apple’s biometric touch sensor.

PhotoKit

photokit-iconPhoto Kit is a new framework that allows applications to query the system image library and create custom user interfaces to view and modify its contents.  For an example of using the PhotoKit framework in Xamarin, see Mike Bluestein’s Build Great Photo Experiences in iOS 8 with Photokit blog post.

Manual Camera Controls

camera-api-icon

The AVFoundation Framework has been enhanced to offer many features that developers can use to deliver professional camera applications, including the ability to control the camera at a low level, with direct access to such things as exposure and focus.

HealthKit

healthkit-iconHealthKit provides system-wide health API that applications can use to store and query a vast amount of health data provided by other apps and accessories.

HomeKit

homekit-iconHomeKit is a home automation API that allows iOS applications to control devices within the home. It brings home automation capabilities to third party applications, extending the reach of such functionality beyond the device makers themselves.

CloudKit

cloudkit-iconCloudKit allows applications to deliver server-based authentication and storage all from a client side API that is available out of the box to iOS 8 users.

Document Picker

document-picker-iconThe document picker provides a mechanism for applications to access documents beyond the applications sandbox in a consistent manner.

Handoff

handoff-iconHandoff allows applications to deliver seamless experiences between OS X and iOS, letting users pick up in an application on one platform right from where they left off on the other platform.

Unified Storyboards

unified-storyboards-iconUnified Storyboards allow a common design-time experience to create user interfaces that works across a variety iOS devices and screen sizes.

SceneKit

scenekit-iconSceneKit is a 3D scene graph API that makes integrating 3D content into your application and causal 3D games a breeze. For an example of using the SceneKit framework in Xamarin, see Mike Bluestein’s Lights, Camera, Action – 3D in iOS 8 with Scene Kit blog post.

SpriteKit

spritekit-iconSprite Kit, the 2D game framework from Apple, has some interesting new features in iOS 8 and OS X Yosemite, including integration with Scene Kit, lighting  and physics enhancements.. For an example of using the SpriteKit framework in Xamarin, see Mike Bluestein’s New Sprite Kit Physics Features in iOS 8 blog post.

Installing Xamarin.iOS for iOS 8

Windows users with Visual Studio, in addition should:

  • Switch Visual Studio Xamarin Updater Channel to “Beta”.
  • Install the Visual Studio extension update.

You can browse our entire API change log and release notes to find out the latest features released today with Xamarin.iOS 8.0 and the new iOS 8 APIs.

Get Ready for iOS 8 Webinar

Xamarin Developer Evangelist Mike Bluestein will provide an overview of the top new and updated APIs it includes. Join us Thursday, September 11th at 8 am PT for this webinar to learn about incorporating all of the great new features into your app.

Register for Get Ready for iOS 8

TwitterFacebookGoogle+LinkedInEmail
September 9, 2014

Get Ready for iOS 8 with Xamarin Webinar

By

iOS 8 iconOn September 17th, iOS 8 will launch with over 4,000 new APIs, making it one of the largest iOS releases ever. Xamarin developers are already able to take advantage of our iOS 8 support, currently in the alpha channel, to start developing with App Extensions, TouchID Authentication, PhotoKit, HealthKit, HomeKit, and so much more.

Join our webinar with Xamarin Developer Evangelist Mike Bluestein this Thursday, September 11th, at 8 AM PDT for an overview of the top new and updated APIs, and how to incorporate all of the great new features into your app.

View the recording of this webinar here.

TwitterFacebookGoogle+LinkedInEmail

Xamarin Evolve 2014 Speaker Spotlight: Jonathan Peppers

By

This is the third post in our Xamarin Evolve 2014 “Speaker Spotlight” series, helping you get to know a little bit more about some of the amazing speakers who will be contributing at this year’s conference.

Photo of Jonathan PeppersToday we’re highlighting Jonathan Peppers, a Xamarin MVP and the lead developer on the MonoGame title, Draw a Stickman: EPIC, winner of two Webby awards for best mobile game and people’s choice for best tablet game. He leads the app development department at Hitcents, a Xamarin Premier consulting partner, and has worked on other successful apps such as The Harlem Shake, Battlepillars, and even the Xamarin Field Service sample app. You can catch Jonathan at Xamarin Evolve giving the talk, “If You Can Ship Your app in China, You Can Ship it Anywhere: In-App Purchase, Piracy Protection, Localization, Culturalization, and More.”

Why did you get into software development?

I’ve always enjoyed computers and playing video games. I started a degree in Computer Science hoping to work on video games some day, but I still enjoy programming in general. In my day job, I’m lucky enough to work on games and interesting apps.

How long have you been doing mobile development?

I’ve been doing mobile development since 2010, when MonoTouch came out. We had to build an iOS app, and we could not stomach Objective-C.

What are your favorite open source libraries, and why?

quotation markI ALWAYS FIND MYSELF USING JSON.NET IN EVERY PROJECT. MY OTHER FAVORITE LIBRARIES ARE MODERNHTTPCLIENT, APPROVALTESTS, AND RAYGUN.

ModernHttpClient is a solid improvement for any web service-based app. ApprovalTests is a great way to think about unit testing, and I always use it for certain types of unit tests. Raygun has helped us on every project we’ve used it with; getting real time error reports is invaluable with mobile apps.

What is the biggest lesson you’ve learned?

My best learning experience was with the first cross-platform app I was involved in developing. Learning techniques for code sharing in cross-platform applications is useful, but can be difficult to wrap your head around. There wasn’t a lot of information out there at the time, since Xamarin was so new.

What devices are you carrying around with you right now?

I have an iPhone 5S and a Macbook Pro that is always in my bag. I used to carry around an iPad as well, but that has become my wife’s full-time “computer”.

What are you doing when you’re not doing mobile development with Xamarin?

I enjoy spending time with my family and playing “nerd games” like Hearthstone and Magic: the Gathering.

If you missed our first two posts, click through to read about Jesse Liberty and Jon Skeet.

TwitterFacebookGoogle+LinkedInEmail
September 8, 2014

Evolve Countdown iOS 8 Today Widget

By

Count down how many days until Evolve from the iOS 8 notification screen using a Today Widget:

today extension

iOS 8 introduces a variety of extensibility features called extensions. Extensions allow applications to offer user experiences throughout the system in ways that were not available previously to third party developers.

With app extensions, applications can now offer features such as custom keyboards, content sharing, and photo editing to name just a few of the new ways to provide system-wide functionality.

Today Widgets

One type of extension is called a Today Widget, which is an extension that lives on the notification screen along with the widgets provided by Apple. This is a great place for an application to offer updated data for people to consume at a glance without having to open the application. Scenarios involving sports scores, package trackers and news headlines make for good Today Widget use cases.

Evolve Countdown Widget

Let’s take a look at a Today Widget that displays the number of days until Xamarin Evolve 2014.

Widgets are created using an Extension Project template under the Unified API project templates, as extensions are required to support both 64 and 32 bit architectures.

extension project templates

You don’t create a stand-alone extension, rather it must be created and referenced from a container application. In this case, I created a small app that displays the Evolve website in a WKWebView and then added the extension project as a reference.

container project

There are a few configurations that need to be set in the Info.plist for the extension:

extension info plist

In this case, I included a button in the extension that, when tapped, will launch the app so the app registers a custom url scheme as well:

custom url scheme

To create the extension, I designed the UI in a storyboard with a UIImage, UILabel and UIButton respectively. Note, since the unified API is required, use Xcode to wire up controls to code (code generation support for the Xamarin designer will come in a future release).

The notification center determines the frame for the extension. The best way to control the layout of controls is using auto-layout, which is what I used here.

Adding the Extension’s Code

A today widget is just a view controller. Therefore, the code is implemented much like other view controllers, as shown below:

public override void ViewDidLoad ()
{
  base.ViewDidLoad ();
  PreferredContentSize = new CGSize (PreferredContentSize.Width, 55f);
  var evolveStartDate = new DateTime (2014, 10, 6);
  var numDays = (evolveStartDate - DateTime.Now).Days;
  WidgetTitle.Text = String.Format ("{0} days until Evolve", numDays);
  WidgetButton.SetTitle ("Tap here to register", UIControlState.Normal);
  WidgetButton.TouchUpInside += (sender, e) => UIApplication.SharedApplication.OpenUrl (new NSUrl ("evolveCountdown://"));
}

When the application is deployed, the user will have the option to include the widget in the notification screen:

include today extension

After adding the widget, tapping the butting results in the app opening, thanks to the custom url scheme it registered:

container app launched

Extensions like Today Widgets allow applications to deliver experiences that only for Apple could provide in the past, so it’s great to see this added flexibility come to iOS.

Join me at Evolve to discuss this and many other exciting new iOS 8 features!

The code from this post is available here.

Discuss this blog post in the Xamarin Forums

TwitterFacebookGoogle+LinkedInEmail

Xamarin.Android Garbage Collection Improvements

By

Mobile operating systems continue to evolve year over year, delivering great APIs for developers to integrate into their apps to create delightful experiences. However, a side effect of this is that the size of the mobile apps that developers are creating on Xamarin is growing. When we designed Xamarin.Android, our Garbage Collector integration was built to handle small to medium sized apps.

Garbage-Sorting-RobotIn large applications this integration, also known as the GC Bridge, was brought to our attention as a source of longer than expected pauses. We took time to dive into the problem and remedy it by introducing two new bridge modes in Xamarin.Android 4.14, currently in the stable channel.

The GC Bridge is responsible for bringing two worlds together: Java and C#. It takes care of the objects that exist on both sides, such as Activity, and makes their lifetime correct for both the Java garbage collector and Mono’s.

Let’s take a look at a benchmark test that creates objects and randomly connects them, which is similar to deep object models we’ve seen in real world apps.

GC Performance 1

As you can see, performance improvements in the new GC bridges are quite drastic. Performance improves 2x to 10x between what we used to get with 4.12 and the new Tarjan mode.

The GC Bridges

Before diving into more details and performance benchmarks, I want to take a moment to describe the different GC Bridges.

    • Old – The default implementation, considered the most stable of the three. This is the bridge that an application should use if the GC_BRIDGE pauses are acceptable.
    • New – A major overhaul of the original code, fixing two instances of quadratic behavior but keeping the core algorithm, based on Kosaraju’s algorithm for finding strongly connected components.
    • Tarjan – A completely new design of the GC Bridge based on Robert Tarjan’s algorithm and backwards reference propagation. It does perform the best under our simulated workloads but has a larger share of experimental code.
    • You can learn more about the Garbage Collector in Xamarin.Android in our Android documentation.

Better, Faster, Stronger

Let’s take a look at a few more performance benchmarks to really see how these new GC Bridges increase the overall app performance.

GC Performance 2

This second benchmark simulates the case where a very popular object is referenced by many objects, which happens frequently when the GUI has lots of callbacks to a central backend object. As you can see, it’s not just faster, but scalable, as the number of incoming links barely affects performance.

GC Performance 3

This last benchmark creates a structure where half of the objects point to a single object that in turn points to the other half of the objects. It’s not common in practice, but it shows how both new bridge modes are necessary – each one shines when used on different workloads, which can only be discovered by trying both.

Enabling this new functionality is as easy as adding an environment.txt file to your project with the BuildAction set to AndroidEnvironment. Then you can specify which GC_BRIDGE option your application should use by passing bridge-implementation=old, bridge-implementation=new, or bridge-implementation=tarjan to the MONO_GC_PARAMS environment variable. Here is an example:

MONO_GC_PARAMS=bridge-implementation=tarjan<br />

Enabling Garbage collection

Our awesome documentation explains in detail how to enable the new bridges so you can make your apps more responsive today.

Learn More

Xamarin Evolve 2014 banner with dates (October 6-10) and location (Atlanta, Georgia)To learn even more about GC Bridges, be sure to join me at Xamarin Evolve 2014, where I will be deep diving into GC and performance on both iOS and Android during multiple sessions.

TwitterFacebookGoogle+LinkedInEmail