June 17, 2015

Expand Your App’s Reach with Google’s App Invites


There were some major announcements at Google I/O 2015, but there were also several exciting enhancements to Google Play Services announced that focus on increasing your app’s reach in the market. app-invites-logoOne of my favorite new features in Google Play Services has to be App Invites, which gives developers a simple way of allowing their users to share their app with friends through e-mail or SMS. App Invites also provides a way for developers to add deep link content in these invitations, enabling a unique way of bubbling up information, such as discount codes or exclusive content, to new users when your app is installed.

How App Invites Work

Traditional app discovery is usually done by browsing a large list of apps or searching for a specific keyword, but App Invites enables apps to be shared user-to-user. When people share an app invite from a mobile app, it kicks off the App Invite flow. Google Play Services handles what happens if an app is installed or not, and provides a deep link for adding additional context. Here’s what a normal flow looks like:


App Invites are currently in beta on both iOS and Android from Google.

Getting Started

For this blog post, I’ll focus on Android development (Xamarin.iOS support is coming soon). App Invites are packaged as part of Google Play Services 7.5, which are currently available as a pre-release NuGet Package. Simply search for “AppInvite” in the NuGet Package Manager in either Visual Studio or Xamarin Studio with the pre-release packages flag enabled.


The next step is to enable Google Services for your Android app. Google has a nice wizard to help you create or choose an existing app to enable services for on the Google Developer Console.

Enter your app name and Android package name:


Check App Invites and then add your Android Signing Certificate SHA-1 information. To find your SHA-1 Fingerprint, simply follow our documentation. If you’ve used Google Maps in the past, this is the same process.

Enable App Invites

After this step in the process, you may be prompted to download and copy a configuration file, however, this is not necessary for Xamarin.Android apps at this time.

Sending App Invites

I’ve decided to integrate App Invites into my app Coffee Filter, which enables you to find coffee shops based on your geolocation. Coffee Filter has a master-detail view setup, and I chose to allow users to send app invites from the coffee shops detail page, which enables me to deep link to the coffee shop in this example.

When you want to trigger the App Invite, you will need to start by creating a new Intent using the AppInviteInvitation.IntentBuilder class. The only required field is the title that is displayed to the user on the invite, but you may want to also provide a message to display and a deep link URL that you can use when receiving the app invite.

int RequestInvite = 0;
void SendInvite()
  var intent = new AppInviteInvitation.IntentBuilder("Invite Friends to Coffee")
	           .SetMessage("Join me for coffee with Coffee Filter")
	           .SetDeepLink(Android.Net.Uri.Parse("http://motzcod.es/" + viewModel.Place.PlaceId))
  StartActivityForResult(intent, RequestInvite);
//Get information back from the App Invites request
protected override void OnActivityResult (int requestCode, Result resultCode, Intent data)
  base.OnActivityResult (requestCode, resultCode, data);
  if (requestCode == RequestInvite)
    if (resultCode == Result.Ok)
      //Check how many invitations were sent. You could optionally track this data as
      //the Ids will be consistent when you receive them
      var ids = AppInviteInvitation.GetInvitationIds((int)resultCode, data);
      ShowMessage("You just sent " + ids.Length + " invites!");
      // Sending failed or it was canceled, show failure message to the user
      ShowMessage("No coffee invites were sent.");

As you can see, I’m deep linking to a specific coffee shop ID that I can use later when receiving the deep link. For your app, you should determine what type of deep link information you want, if any. With just this code, your users will now have the ability to send app invites out:

Nexus 4 (Lollipop) Screentshot 1

This will send out an e-mail with your app on a card view, enabling a one-click install of your app:
App Card

Receiving App Invites

When a user receives and accepts an app invite, the app may or may not be installed. This means you will need to handle each instance separately. If the app is already installed, you can simply handle and process the app invite in your Main Activities OnCreate method, with just a few lines of code:

protected override void OnCreate(Bundle bundle)
  // No savedInstanceState, so it is the first launch of this activity
  if (bundle == null && AppInviteReferral.HasReferral(Intent))
    // In this case the referral data is in the intent launching the MainActivity,
    // which means this user already had the app installed.
// Process the deep link information, however if you don't have any deep links
// this may be a good time to welcome them to the application
public void LaunchDeepLinkActivity(Intent intent)
  var newIntent = new Intent (intent);
  newIntent.SetClass (this, typeof(DetailsActivity));

If the user doesn’t have the app installed, they will install it and then the Google Play Store will send a broadcast out notifying your app to process the deep link. You will need to create a ReferrerReceiver that will handle this broadcast:

[BroadcastReceiver(Exported = true)]
[IntentFilter(new []{"com.android.vending.INSTALL_REFERRER"})]
public class ReferrerReceiver : BroadcastReceiver
  public override void OnReceive (Context context, Intent intent)
    // Create deep link intent with correct action and add play store referral information
    var actionIntent = new Intent(context.GetString(Resource.String.action_deep_link))
    var deepLinkIntent = AppInviteReferral.AddPlayStoreReferrerToIntent(intent, actionIntent);
    // Let any listeners know about the change

Inside of your MainActivity, you will need to register a new local broadcast receiver that will receive this broadcast and launch the deep link activity.

class InviteBroadcastReceiver : BroadcastReceiver
  readonly MainActivity activity;
  public InviteBroadcastReceiver(MainActivity activity)
    this.activity = activity;
  public override void OnReceive (Context context, Intent intent)
    if (!AppInviteReferral.HasReferral (intent))
    activity.LaunchDeepLinkActivity (intent);

You should register and unregister this broadcast receiver in the OnStart and OnStop methods of your activity.

InviteBroadcastReceiver deepLinkReceiver;
void RegisterDeepLinkReceiver()
  // Create local Broadcast receiver that starts
  //DeepLinkActivity when a deep link is found
  deepLinkReceiver = new InviteBroadcastReceiver(this);
  var intentFilter = new IntentFilter(GetString(Resource.String.action_deep_link));
  LocalBroadcastManager.GetInstance(this).RegisterReceiver(deepLinkReceiver, intentFilter);
void UnregisterDeepLinkReceiver()
  if (deepLinkReceiver == null)
protected override void OnStart ()
  base.OnStart ();
  RegisterDeepLinkReceiver ();
protected override void OnStop ()
  base.OnStop ();
  UnregisterDeepLinkReceiver ();

Finally, when your deep link activity starts, you’ll want to process the incoming intent to see if you need to handle the deep link action. In my app, I parse out the place ID that we sent earlier and refresh the data.

protected override void OnStart ()
  base.OnStart ();
  ProcessReferralIntent (Intent);
void ProcessReferralIntent(Intent intent)
  if (!AppInviteReferral.HasReferral (intent))
  var invitationId = AppInviteReferral.GetInvitationId (intent);
  var deepLink = AppInviteReferral.GetDeepLink (intent);
  var info = deepLink.Replace ("http://motzcod.es/", string.Empty);
  viewModel.Place.PlaceId = info;
  RefreshData ();

Now, when the app is launched it will go directly to the deep linked coffee shop:

Nexus 4 (Lollipop) Screentshot 3

Learn More

To learn more about App Invites, including tracking invitations, be sure to see the Google App Invites documentation. Additionally, you can find the entire source code for Coffee Filter with App Invites on my GitHub.

Discuss this post in the Xamarin Forums

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
June 15, 2015

Forums Updates: Badges and More!


The Xamarin Forums have been growing exponentially and now see over one million page views monthly! Our forums provide a great place to ask questions, share experiences, and discuss technical and community related topics. In addition to our posted forums guidelines, we’ve also recently introduced a community moderator program to help ensure the forums continue to provide a great experience for everyone in the community, at all times.

Today, we’re happy to announce the introduction of new forums badges to some of our more accomplished community members, as well as some improvements we’ve introduced to the process of posting new forums topics.


Our new badges give titles and recognition to members of the community who have accomplished goals or earned certification. The following badges have been integrated into the forums and are being awarded to community members as they earn them:


  • Xamarin University Professor
  • Xamarin Team Member
  • Xamarin MVP
  • Xamarin Certified Developer
  • Xamarin Student Ambassador
  • Xamarin Group Leader

You can earn one of these badges for yourself by completing Xamarin Certification through Xamarin University, starting up a local user group, or by being a stand-out community member in your school or the developer community at large.

Ask a Question

2015-06-15_0958We wanted to make it as easy as possible to ask a question in the Xamarin Forums, so we’ve added a new “Ask a Question” button. Creating threads with this button allows you to mark replies to your thread as answers, so others can quickly find the answers to the questions they have been looking for. Users will also be able to see from the list of threads in a particular forum if their question has been answered or not, allowing further visibility into question status without having to open the thread directly. Feedback so far has been incredibly positive, with significantly more questions being asked (and answered) daily! 

Get Involved Today

With topics ranging from iOS and Android to Xamarin.Forms and Xamarin Test Cloud, the forums are a great place to exchange knowledge, tips and tricks, and ask and answer questions. To get started, visit the Xamarin Forums and become a member of our growing community today!

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
June 12, 2015

Xamarin Podcast: WWDC and Google I/O 2015


This week on the Xamarin Podcast, we recap the awesome announcements from WWDC and Google I/O 2015. If you missed them yourself, or want to know our thoughts on how Android M, iOS 9, and OSX El Capitan affect developers, this week’s special editions of the Xamarin Podcast are a must listen!

podcast icon


In our WWDC 2015 Special Episode, we discuss OS X El Capitan, iOS 9, Apple Watch, HomeKit, and all of the exciting announcements from WWDC.

Google I/O

Android experts James Montemagno and Jeremie Laval join us to recap Google I/O 2015, including Android M, Android Wear, Google Play Services 7.5, and to share their experiences attending Google I/O in-person at the Moscone Center.

Subscribe or Download Today

Knowing the latest in .NET, C#, and Xamarin is easier than ever with the Xamarin Podcast! The Xamarin Podcast is available from both iTunes and SoundCloud. Do you have an interesting story, project, or advice for other .NET mobile developers? If so, we would love to share it with the Xamarin community. Tweet @pierceboggan or @MikeCodesDotNet to share your blog posts, projects, and anything else you think other mobile developers would find interesting. Be sure to download our WWDC and Google I/O special episodes today, and don’t forget to subscribe!

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
June 11, 2015

Crafting 5 Star iOS Experiences with Transitions


Last month, I wrote a blog post on creating beautiful animations using iOS APIs. Subtle use of animations and transitions in iOS can turn an average app into a five-star app. iOS has many built-in transitions between views that can be leveraged as a great starting point for adding animations to your iOS apps. However, with just a little bit of work, you can create custom transitions that will give your app a unique experience, spice up an otherwise generic user experience, and take your iOS app to the next level.


Getting Started

Normally, when we call the following API, we would expect our view to animate in from the left side:

 PresentViewControllerAsync(ourViewController, true); 

If we want to spice up our app with a custom transition, we can continue to use the same API to present the new UIViewController, but we’ll need a way to tell iOS about our custom transition. iOS gives us an easy way to customize a UIViewController’s transition via the delegate pattern: just set the view controller’s transition delegate to a subclass of UIViewControllerTransitionDelegate.

Every time you ask iOS to present a new view controller, UIKit will check to see if it has a transition delegate to use in place of the default transitions. If you don’t provide a transition delegate, it will use the built in transitions (i.e. animating the new view in from the left, or, if a modal transition, from the bottom).

Creating a Custom Transition

Transitions are made up of three subclasses: UIViewControllerAnimatedTransitioning, UIViewControllerTransitionDelegate, and UIPresentationController. I suggest starting with a subclass of UIViewControllerAnimatedTransitioning and then moving on to the transition delegate, as the AnimatedTransitioning class is where we’ll implement our custom transition.

Implementing UIViewControllerAnimatedTransitioning

To implement UIViewControllerAnimatedTransitioning, you must use two main methods. The TransitionDuration method defines exactly how long the transition should last, while the AnimationTransition method is where all the magic of actually making a UIViewController animate happens. Below is a sample implementation that I’ve taken from the iOS version of my Dutch Spelling app:

public class MyCustomAnimator : UIViewControllerAnimatedTransitioning
    public bool IsPresentation = true;
    CGRect startFrame = CGRect.Empty;
    public MyCustomAnimator(CoreGraphics.CGRect frame)
       startFrame = frame;
    public override double TransitionDuration (IUIViewControllerContextTransitioning transitionContext)
       //How long will the transition last?
       return 0.8;
    public override void AnimateTransition (IUIViewControllerContextTransitioning transitionContext)
       //Where we'll add our transition!

The key part of UIViewControllerAnimatedTransitioning is the AnimateTransition method. This method allows you access to both the current view controller and the new view controller you want presented to the user. You can animate the view controllers view using the wonderful iOS animation APIs, which allow you to scale, fade, rotate, and create beautiful transitions. You can see how I have implemented the AnimateTransition method to show a basic transition:

public override void AnimateTransition (IUIViewControllerContextTransitioning transitionContext)
    //The current view controller
    var fromVC = transitionContext.GetViewControllerForKey (UITransitionContext.FromViewControllerKey);
    var fromView = fromVC.View;
    //The view controller we wish to present to the user
    var toVC = transitionContext.GetViewControllerForKey (UITransitionContext.ToViewControllerKey);
    var toView = toVC.View;
    //ContainerView is where our animation will live
    var containerView = transitionContext.ContainerView;
    var isPresentation = IsPresentation;
    if (isPresentation)
    var animatingVC = isPresentation ? toVC : fromVC;
    var animatingView = animatingVC.View;
    var appearedFrame = transitionContext.GetFinalFrameForViewController (animatingVC);
    var dismissedFrame = this.startFrame;
    var initialFrame = new CGRect(0, toView.Frame.Height + 100, toView.Frame.Width, toView.Frame.Height);
    var finalFrame = isPresentation ? appearedFrame : dismissedFrame;
    animatingView.Frame = initialFrame;
    var lessonOptionsVC = toVC as LessonTypeViewController;
    var defaultFrame = lessonOptionsVC.ContainerView.Frame;
    lessonOptionsVC.ContainerView.Frame = new CGRect(lessonOptionsVC.ContainerView.Frame.X, -500, lessonOptionsVC.ContainerView.Frame.Width, lessonOptionsVC.ContainerView.Frame.Height);
    UIView.AnimateNotify (0.5f,
                UIViewAnimationOptions.AllowUserInteraction | UIViewAnimationOptions.BeginFromCurrentState,
                () => {
                animatingView.Frame = finalFrame;
                lessonOptionsVC.ContainerView.Frame = defaultFrame;
            },  new UICompletionHandler((bool finished) => {

Implementing UIViewControllerTransitionDelegate

The main purpose of the UIViewControllerTransitionDelegate class is to manage the animator object that performs the animations. It will need to reference a subclass of UIViewControllerAnimatedTransitioning, which contains a few key properties that must be overloaded:

public class MyCustomOptionsTransitionDelegate : UIViewControllerTransitioningDelegate
    CoreGraphics.CGRect startFrame;
    private MyCustomOptionsTransitionDelegate lessonOptionsPresentationController;
    private LessonOptionsAnimator animationTransitioning;
    public LessonOptionsAnimator AnimationTransitioning
          if (animationTransitioning == null) {
             animationTransitioning = new LessonOptionsAnimator(startFrame);
          return animationTransitioning;
    public LessonOptionsTransitionDelegate (CoreGraphics.CGRect startFrame)
       this.startFrame = startFrame;
    public override UIPresentationController GetPresentationControllerForPresentedViewController (UIViewController    presentedViewController, UIViewController presentingViewController, UIViewController sourceViewController)
        return new LessonOptionsPresentationController(presentedViewController, presentedViewController);
    public override IUIViewControllerAnimatedTransitioning GetAnimationControllerForDismissedController(UIViewController dismissed)
        return null;
    public override IUIViewControllerAnimatedTransitioning GetAnimationControllerForPresentedController(UIViewController presented, UIViewController presenting, UIViewController source)
       var transitioning = AnimationTransitioning;
       transitioning.IsPresentation = true;
       return transitioning;


Using custom transitions and animations is an easy way to make your app stand out in the Apple App Store and take your app to the next level. To learn more about the animation APIs available for iOS, check out our documentation.

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone

Better Apps & Faster Release Cycles Part IV


This week, we launched a four part series that covers simple steps you can take to improve your apps and make your release cycles faster. Our advice is based on real-world challenges and rewards from Niels Frydenholm, Senior iOS Developer at eBay Classified, who spoke at Xamarin Evolve 2014.

Today we’ll look at how to put the pieces together and expand your focus.

In the first three parts of the series, we discussed the path from manual testing to automation, integration with release management, and how and why to target real devices in the cloud. If you’ve made it through all three steps, you’re ready to reimagine quality in your organization, and focus resources on higher value, more strategic activities.

Shifting Focus

Automation allows QA and development to shift out of fire-fighting mode and reclaim time. In the first stage of the shift, developers and testers will have time to perform creative work that can further increase test quality, efficiency, or coverage. For example, eBay’s dedicated tester can now focus more of his time on supplementing automated testing with manual exploratory tests, and its developers no longer have to worry about building on top of the fragile legacy code created by their former waterfall process. The team can now focus on creativity and productivity, rather than playing clean-up.

A new direction in test strategy and tooling provides a rare opportunity to quantify the impact of quality assurance. Within a short time, developers should notice substantial changes in quality KPIs, from performance data and crash frequency to internal metrics, such as open bugs and time-to-resolution (TTR). This information can be invaluable during budgeting, as it assigns objective value to a traditionally hard-to-quantify discipline. It also lays the foundation for the next stage of the shift that makes quality a company concern.

Elevating the Discussion

Screenshot of Xamarin Insights

“If you have happy customers, you’re going to have a happy boss.”

The next phase of the shift expands the definition of quality and the participants in the quality process. By integrating an automated test and release management system with user monitoring and analytics such as Xamarin Insights, teams can redefine quality assurance from a reactive, tactical bug-catching role to a provider of data-driven, strategic guidance for a continuous “build → test → monitor” workflow.

While QA will remain the gatekeeper for this data, the dissemination of this information should also be automated. Starting with departments closest to the product (typically sales, marketing, and product management), you can work with IT to integrate core quality metrics into business apps and dashboards other departments use to justify business decisions.

Putting it All Together

Mobile testing is imperative, but regardless of sophistication or size, most developers are doing it poorly – or not at all. eBay’s business and scale are unique, but the problems they experienced are not, and all mobile developers can learn from their example. To maintain a competitive release schedule without sacrificing quality, developers must embrace test automation, test on real devices, and integrate those tests with development and release processes. Implemented properly, testing can integrate with minimal overhead and have an immediate impact on product quality, developer happiness, and user satisfaction.

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
June 10, 2015

Better Apps & Faster Release Cycles Part III


This week, we launched a four part series that covers simple steps you can take to improve your apps and make your release cycles faster. Our advice is based on real-world challenges and rewards from Niels Frydenholm, Senior iOS Developer at eBay Classified, who spoke at Xamarin Evolve 2014.

Today we’ll look at how to expand your testing program beyond simulators to real devices.

Would you fly with a pilot who had only used flight simulators?

“Don’t trust only emulators and simulators. You have to run on real devices, as well.”

Simulators provide quick, useful feedback, which can be an important component of efforts such as eBay’s commit tests – short tests run by developers on their own code, designed to validate basic functionality. Still, simulators are only an approximation of deployment environments, running on very different, much more powerful hardware. As such, they can mask a number of real problems while indicating others that simply do not exist. For example, several Xamarin Test Cloud customers have noted false returns from simulators in performance-dependent areas such as timing and graphic rendering.

It’s also important to remember that simulators are software applications, and they may carry their own inconsistencies and bugs. eBay noticed that a number of its intermittent, non-reproducible test failures were actually driven by problems with their simulators. The company was ultimately able to code around these failures by automatically rerunning failed tests to eliminate false negatives, but the differences between a true live device and a software simulation are significant.

Ultimately, your app will be deployed on real-world devices, each with its own set of design quirks, limitations, and bugs, and the only way to guarantee performance and quality is to test against real-world targeted platforms. This is not unique to mobile, as QA departments have been testing against a range of supported systems since the beginning of software development. What is unique to mobile is the vast device and OS fragmentation that exists, making on-device testing far more critical while also more difficult to achieve.

How to Test on Real Devices

Xamarin Test Cloud devices
eBay offered three tips for managing resources while making the jump to real device testing:

  • Don’t manage it all yourself. eBay noted the overhead of testing on even their relatively small number of target iOS platforms. “We don’t really have time to install and test on that many devices,” said Niels, so they chose to test on real devices in Xamarin Test Cloud. He also notes that for developers supporting even a handful of Android platforms, this fragmentation is far more complicated.
  • Have your tests in order. Before you deploy tests to Xamarin’s device cloud, make sure you actually have a stable test suite on your local machine.
  • Results reporting matters. Testing on a large number of devices will create a large volume of results. eBay receives detailed reporting from nightly test runs that feed directly into its CI system. The team has access to detailed test data, including screenshots and video from different devices that can help in pinpoint the exact reasons for failures.

Just as in aviation, there are real-world conditions for mobile apps that cannot be simulated and that are only be surfaced and dealt with by experience in real environments. Xamarin Test Cloud makes that easy.

If you missed the beginning of the series, you can find Part I here and Part II here. In Part IV, we’ll look at how test automation helps teams do more important work.

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone

Keep Users from Leaving Your App with Chrome Custom Tabs


Xamarin Chrome Custom TabsChrome Custom Tabs were one of the exciting announcements made at Google I/O 2015 that you can try now in your Xamarin apps.

If your app is like many others today, you may provide your own in-app web browser experience when displaying linked web content to your users. This provides a seamless and branded user experience, but misses out on things like saved passwords and form data.

With Chrome Custom Tabs, you get the best of both worlds. You can still deliver a branded experience that feels like it’s right inside your app, while your users get all of the power and familiarity of Chrome.

Loading a URL

Loading your URL in a Chrome Custom Tab couldn’t be any easier, as it only requires a couple of lines of code:

var hostedManager = new HostedActivityManager (this);
var uiBuilder = new HostedUIBuilder();
// Add any optional customizations here...
hostedManager.LoadUrl ("http://xamarin.com", uiBuilder);


It’s easy to specify your own colors for branding the toolbar and start and exit animations for activity. This will ensure your users feel like they’ve never left your app.

// Set the Toolbar Color
uiBuilder.SetToolbarColor (Color.Red);
// Customize animations
uiBuilder.SetStartAnimations (this, Resource.Animation.slide_in_right, Resource.Animation.slide_out_left);
uiBuilder.SetExitAnimations (this, Resource.Animation.slide_in_left, Resource.Animation.slide_out_right);

It’s also possible to add your own Toolbar items and menu items to the overflow menu.

Getting Started

While Chrome Custom Tabs currently only works with Chrome Dev (44 and higher), it will gracefully fall back to opening URL’s in your default browser if Custom Tabs aren’t available.

Check out our Chrome Custom Tabs Component, which includes a sample app to help you get started today!

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
June 9, 2015

WWDC 2015 Recap for iOS Developers


Yesterday was an exciting day for iOS and Mac developers, with a slew of announcements during the kick off of Apple’s annual developer conference, WWDC. There was something for every developer, from tons of new APIs to operating system updates spanning mobile, desktop, and watch. Here are some of the biggest takeaways from the keynote to help you get your existing apps ready for the public release in the fall.

apple devices

iOS 9

All of the rumors that Apple would announce iOS 9, which sees a focus on four key areas of the iOS ecosystem including intelligence, apps, iPad, and foundation, were proven true.




spotlight-ios_2x 2015 will be the year of virtual personal assistants, as all major mobile operating systems now include functionality for communicating with your device via voice. Apple has focused on Siri and Spotlight integration, which allow your users to search your app from Spotlight via text or simply by asking Siri. This is all made possible using a number of new search APIs, such as the Core Spotlight API and the new NSUserActivity APIs.

One interesting feature of the new search functionality in iOS 9 is how iOS computes the relevancy of the information it has retrieved from installed apps. iOS will compute this using information such as the frequency that users interact with your app, the time that passes between tapping the result, and your app launching and displaying the information.


It’s now possible to opt into new iOS multitasking features such as Splitmultitasking_2x View and Picture-in-Picture. Split View is fairly self explanatory: it allows the iPad to display two apps side-by-side while allowing users to interact with them at the same time. Xamarin developers are ready to support multitasking as Xamarin.iOS has supported Autolayouts and Size classes since iOS 8, which is a prerequisite of this new feature. If you’re looking for information on how to get started with Autolayouts and size classes, you’ll find a helpful video by Adrian Stevens from Xamarin Evolve 2014 here.

Tons of New APIs

Apple focused on Search and Multitasking, but also announced a variety of amazing new APIs that developers will be able to take advantage of when iOS 9 is released. For game developers, GameplayKit introduces an easy-to-use rule engine and other game development tools. Combined with ReplayKit to record in-game videos and Mobile I/O for creating physically-based material, models, and lighting, you have a lot of tools in your game development toolkit. There are also a ton of great enhancements in some of Apple’s most popular SDKs including HomeKit, HealthKit, MapKit, and CloudKit, allowing developers to build even more brilliant iOS apps.

For information regarding iOS 9 compatibility with existing Xamarin.iOS apps, check out our release blog.

WatchKit for watchOS 2



Just six weeks after Apple started shipping Apple Watches to customers, they’ve released watchOS 2, which supports native apps running on the app. As it stands, apps built for Apple Watch only host the user interface, with all of the app logic running on a connected iPhone.

If you’ve already shipped an Apple Watch app then you’re aware of some of the restrictions that Apple had on WatchKit apps. However, with watchOS 2 you will have full access to connect to known networks, animations, microphone, and even play audio right from your full app running on the Apple Watch. You’re in luck if you’ve already shipped your app to the Apple App Store, as Apple has promised to fully support existing extension-style WatchKit apps when watchOS 2 launches!

Check out the watchOS 2 page on Apple’s developer portal and their full documentation to learn more.

El Capitan


In addition to all of the mobile excitement, Apple has announced the next version of Mac OS X, which is focused on stability and performance. On top of ensuring our existing apps have a performance boost, they’ve also added a number of interesting features such as Pinned Sites for Safari, multiple tabs within Mail, and natural language searching with Spotlight.


Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone

Better Apps & Faster Release Cycles Part II


This week, we launched a four part series that covers simple steps you can take to improve your apps and make your release cycles faster. Our advice is based on real-world challenges and rewards from Niels Frydenholm, Senior iOS Developer at eBay Classified, who spoke at Xamarin Evolve 2014.

Today, we’ll look at how integrating automated tests with your release cycles can cut the total time to release by 50% or more.

Optimizing Release Cycles

“By the end of the year, we were releasing on all supported platforms monthly.”

eBay Classifieds 2014 Release schedule from Xamarin Evolve 2014 talk

With multiple developers working in overlapping areas of code, eBay uses Jenkins to manage a variety of automated tests to ensure that its CI efforts run smoothly without slowing down the development process. By automating not just test execution, but also test setup, eBay removed the overhead and potential for error from test management, streamlining their entire development process.

As a result, eBay doubled the number of supported app platforms and pushed more than twice as many releases in 2014 as they did at the start of 2013.

Tips for Getting Started

Niels offered three tips for optimizing releases:

  • Optimize for speed. To minimize negative impact, isolate developers from as much testing overhead as possible, and provide rapid feedback after each change, eBay uses different test suites for different jobs.
    • Ten minute commit tests: eBay’s commit tests during the day are limited to a roughly ten minute subset of the full test suite. This provides an adequate level of assurance to the developer without becoming disruptive.
    • Daily full suite: At the end of the day, they run a full one-hour test suite to ensure complete coverage.
  • Trim the fat. Niels suggested writing around UI-based overhead for test set-up and tear-down. For example, if a UI test is designed to verify that a logged-in user can modify data through a form, the process of creating the user account, logging in, and populating the initial data set can often be automated through a faster, script-based approach without invalidating the test itself, as long as the scripted functions are tested in full elsewhere.
  • Automate job creation. eBay creates branches for new features under development in order to keep its master branch clean for an App Store upload. Unfortunately, this creates a number of opportunities for human error. “We got kind of lazy. When we would make a new branch, we would have to copy all the jobs in Jenkins, and that wasn’t much fun, so developers would start skipping that.”
    The company has now automated test setup and tear-down on the build server, which creates the jobs necessary to run UI tests on all platforms whenever it sees a branch beginning with the word “feature.” Once the feature branch has been merged to the master, the build server automatically deletes the jobs it created.

“Prior to automating job creation we found bugs way too late. Whether developers branch or not, we always want to find bugs as fast as possible.”

If you missed the beginning of the series, you can find Part I here. In Part III we look at which target platforms fit your testing needs and in Part IV, we explore how test automation helps teams do more important work.

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
June 8, 2015

Put Some Cyanogen in Your Xamarin Apps


CyanogenMod SDK on XamarinCyanogenMod is an enhanced open source firmware distribution of Android that offers customizable features and options. Cyanogen continues to grow in popularity, and they recently introduced an early version of their platform SDK. Cyanogen launched this SDK by seeding it with the Quick Settings Tile API. Cyanogen’s Leigh Momii and Adnan Begovic say they hope to inspire the Cyanogen community to understand what’s possible and think up additional APIs to add to CyanogenMod.

Quick Settings Custom Tiles are a great way to add an easy, global way for your users to do things like toggle a feature of your app on and off.

Adding a Quick Settings Custom Tile to your Xamarin.Android app is easy with the new CyanogenMod SDK for Xamarin in the Xamarin Component Store.

After you’ve added the component to your project, you can use the CustomTile.Builder to build your tile:

var customTile = new CustomTile.Builder (this)
    .SetOnClickIntent (pendingIntent)
    .SetContentDescription ("Monkey Toggler")
    .SetLabel ("Monkeys " + States.Off)
    .SetIcon (Resource.Drawable.ic_launcher)
    .Build ();

Once you’ve created your custom tile, you can publish it with the CMStatusBarManager:

CMStatusBarManager.GetInstance (this)
    .PublishTile (CustomTileId, customTile);

The CustomTileId is a unique ID associated with your tile. When you publish a new tile with the same ID, it will update the existing tile under that identifier, making it possible to change the appearance based on the current state of your app.

Don’t worry if your app isn’t running on CyanogenMod – in such a case, the SDK will gracefully fail. Rather than seeing exceptions, Custom Tiles won’t be published on platforms that don’t support it, so you can feel safe adding this feature to your app!

This is only the first feature that CyanogenMod has released in its Platform SDK, and we’re excited to see what new features the CyanogenMod community will add in the near future. Go grab the CyanogenMod SDK for Xamarin component today and give your Cyanogen users a better experience!

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone