August 28, 2014

Couchbase Joins Xamarin Evolve 2014

By

Couchbase LogoWe’re excited to announce that Couchbase will be joining us at Xamarin Evolve 2014 as a Silver Sponsor. You won’t want to miss this opportunity to learn more about using Couchbase Lite for .NET with Xamarin from Zack Gramana, Senior Software Engineer at Couchbase and the author of Couchbase’s Xamarin component, along with Wayne Carter, Couchbase’s Chief Architect of Mobile.

Couchbase Lite for .NET was jointly developed by Xamarin and Couchbase, and is the world’s first and only full featured, flexible, mobile JSON database that runs locally on the device. Wayne Carter and Zack GramanaZack and Wayne will cover, “Building Mobile Apps That Work Online & Offline with Couchbase,” in the Mobile Ecosystem Track at Xamarin Evolve 2014, where you’ll learn how Couchbase Lite for .NET’s low-friction document datastore, powerful MapReduce queries, and drop-dead simple synchronization combine to help you build awesome apps faster and easier. They’ll also cover common use cases and show you how easy it is to integrate into your apps so that they “just work” — anytime, anywhere.

Register for Xamarin Evolve 2014 now to learn about Couchbase Lite for .NET and so much more!

TwitterFacebookGoogle+LinkedInEmail
August 27, 2014

Tips for your First Wear App

By

Android Wear was officially released at Google I/O 2014, giving developers a unique opportunity to create Android apps for a new class of devices.

With our recently announced preliminary support in Xamarin.Android you are not only able to extend your current application with enhanced notifications, but also develop an app that runs directly on the wearable and can sync data between your handheld app and wearable app.

In this article, we will cover the basics of Android Wear. For more information, I also invite you to bookmark Chris Hardy’s “C# is in my ears and my eyes” Evolve 2014 session, where he will cover Android Wear among other emerging devices goodness.

wear_long

Add Wearable Features to Notifications

The simplest way to support the new Wear platform is to take advantage of the shared nature of notifications between the phone and the wearable. By using the support v4 notification API and the WearableExtender class available with our NuGet package, you can also tap into the native features of the platform, like inbox style cards or voice input by spicing up your existing Notifications.


03_actions13_voicereply

Companion Applications

screenshot-framedAnother strategy is to create a complete companion application that runs natively on the wearable. This is easier than you might think because, in essence, developing for Android Wear is just like developing for your Android phone, since it’s running the same Android platform.

As an example (among all the other fantastic ones), I added a simple Wear companion to our Xamarin Store app, allowing you to browse the catalog from your wrist and add/remove items from your order

Below you’ll find some tips to get you started on your own Wear applications.

Getting Started

As part of the last release of Xamarin Studio, we have added a new template to easily create a new Android Wear application:

Screen Shot 2014-08-19 at 6.44.02 PM

The template automatically created references our Wearable NuGet, giving you access to the wear UI toolkit and communication API.

User Interface

The primary navigation pattern for Wear is a series of cards arranged vertically. Each of these cards can have associated actions that are layered out on the same row. The pattern is more generally called 2D Picker.

The GridViewPager class part of the Wearable NuGet allows you to just do that. Adhering to the same adapter concept as ListView and friends, you generally associate it with a FragmentGridPagerAdapter that lets you represent each row and column cells as a Fragment.

2D_picker

There is also a Wear specific design for action buttons, consisting of a big colored circle and a small description text underneath. Although there is currently no built-in widget to do this in the library, it’s very easy to do it yourself by using a simple custom layout and a state-list drawable file.

Communication

Being companion to a phone application, wearable apps need to be able to communicate with their host. Android Wear gives you access to two different communication APIs to do this.

First is the Data API, which is akin to a synchronized datastore between the wearable and the phone. The platform will take care of propagating changes to the other side when it’s optimal to do so. It’s also able to smartly detect when the wearable is out of range and queue up the synchronization for later.

Second is the Message API, which allows you to use a lower level, small payload, fire-and-forget type of communication. With this API you can craft small message to which you associate a URL path and a byte array content that you can send directly to a node in the Wear network.

The Xamarin Store wear app uses both APIs for different purposes. The Data API is used to transfer the available products and their associated image assets whereas the Message API allows the wearable to send order to the phone like refresh the store information or add/remove item from the cart.

wear_phone_communication

These APIs are available as part of our Wearable NuGet on the wearable and via our Google Play Services preview NuGet on the phone (version 19). You can register the API through the now-uniform Google Play Services connection service.

The main entry points for the two APIs are respectively WearableClass.DataApi and WearableClass.MessageApi. You can choose to register callbacks for receiving those messages via each of the API listener interfaces or alternatively implement a service in your app deriving from WearableListenerService that will automatically be instantiated by the Wear Android subsystem.

Deployment

Wearable applications are deployed as their own APK file embedded inside the main application APK. Since this is a preview release, we haven’t yet ironed out the perfect way to automate this process, but for now it’s still possible and easy to manually package your Wear application.

Note that if your wearable application wants to communicate with your phone application, you will need to properly install the phone app APK containing the Wear child APK at least once on your phone device so that the initial binding is done. Afterwards, you can directly deploy and debug your Wear app from the wearable.

TwitterFacebookGoogle+LinkedInEmail
August 26, 2014

Introduction to Android Material Design

By

We recently announced preliminary support for Android L Developer Preview, and as you dive into playing with the new SDK you will immediately notice one of the biggest enhancements is the brand new Material Design concepts that Google has developed. This is the first time that Google has created a full design specification for developers to work off of when creating Android applications. In this post I will introduce the main concepts and impact of Material Design for Xamarin developers including:

  1. Theming and Accenting your Android App
  2. Elevation and View Shadows
  3. New Drawable Capabilities

material design

Additionally, Jérémie Laval and I will be giving a wonderful session at this year’s Evolve entitled Android Material Design from Concept to Implementation. In this session we will cover every aspect of Material Design including design concepts, new widgets, animations, compatibility, and so much more.

Setting Up Your Project

Before we get started be sure you have all of the latest Xamarin.Android and Android SDKs installed. Be sure to read our Android L Developer Preview Support announcement for full details of how to get started. Once you have your project open you will want to update the Target, Minimum, and Compile Target Framework found under your project options General and Android Application settings. In the future, you will want to change your Minimum Target to support older frameworks, but since Android L is not officially released you won’t be able to ship L apps to Google Play yet. Additionally, be sure to create an Android L emulator or have a device such as a a Nexus 5 or 7 that can run the Android L Developer Preview.

MinTarget Android L
General Target

Material Theme

When developing Android applications you are able to use and customize themes to brand your application. You might already be familiar with the Holo theme that has become very popular in the last few years. Android L introduces a brand new Material Theme in multiple flavors that you are able to use in your application. These will not only theme your ActionBar, but will give you a refreshed style for all of the controls. Here are the three themes available:

  • @android:style/Theme.Material (dark theme)
  • @android:style/Theme.Material.Light (light theme)
  • @android:style/Theme.Material.Light.DarkActionBar

Android Material Themes

To start to use these themes you will first need to create a new folder in the Resources folder called values-v21. This is where any of your Material Theme customization should be placed. Since you will most likely need to support older versions of Android you would want to fallback to a supported Theme in the Resources/values folder for older versions. With this folder in place you should now create a new styles.xml file and create a new theme for your application that inherits from one of the themes above (to support older versions create a styles.xml in your /values folder and create a theme with the same name there). Here is a new theme for my app called AppTheme which is of the default dark material theme:

<resources>
  <style name="AppTheme" parent="android:Theme.Material">
  <!--Customizations Here-->
  </style>
</resources>

To use this theme you simple need to add it to your AndroidManifest.xml under the application node:

<application android:label="My Awesome App" android:theme="@style/AppTheme">
</application>

Alternatively, you can set it on a specific Activity with the Theme attribute.

[Activity (Label = "MaterialTheme",
           Theme = "@style/AppTheme")]

Add Branding

CustomThemeSometimes the default color schemes might not match your companie’s brand or you might just not like them. No worries, as Google has made it extremely simple to customize the Material themes by setting these three properties in your theme:

  • android:colorPrimary – Your app’s branding color
  • android:colorPrimaryDark – Darker variant of colorPrimary, used by default for status bar
  • android:colorAccent – Accent color for UI controls

Here is what a Xamarin based theme might look like with these colors:

<style name="AppTheme" parent="android:Theme.Material.Light">
  <item name="android:colorPrimary">#3498DB</item>
  <item name="android:colorPrimaryDark">#2C3E50</item>
  <item name="android:colorAccent">#B455B6</item>
</style>

You can customize the status bar with the android:statusBarColor attribute.

Elevation

When developing for Android L you are no longer restricted to just the X and Y properties of a control and have the ability to adjust the Z value to elevate controls off the page. To achieve this we are able to set the android:elevation attribute on our element using a specific size such as 2dp, which is used to determine the size of the shadow.

The shadow is drawn against the view’s background drawable. Let’s say you wanted to add an elevation to a TextView. You could set a background color and elevation, but you can spice it up and create a circle drawable for the TextView’s background with a specific fill color:

<!-- Resources/drawable/mycircle.xml -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="oval">
    <solid android:color="#3498DB" />
</shape>

You would then set the elevation and background attributes on the TextView:

<TextView
  android:id="@+id/my_circle_text"
  ...
  android:background="@drawable/mycircle"
  android:elevation="2dp" />

Here are three lined up with different elevations:
Android Elevations

You are also able to set a translation of a view for animations using the View.SetTranslationZ method.

Drawable Tinting

A unique addition to Android L is that you can now define bitmaps as an alpha mask and easily tint them by using the android:tint attribute. You no longer have to create multiple versions of your assets to simply change their colors. Mixed with the new theme color attributes and the brand new Palette Library that enables you to get colors samples from an image you can do some amazing things. Here is an example of a white Xamarin logo tinted in a few different colors with a circle background:

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal">
    <ImageView
        ...
        android:src="@drawable/xamarin_white"
        android:background="@drawable/mycircle"/>
    <ImageView
        ...
        android:src="@drawable/xamarin_white"
        android:background="@drawable/mycircle"
        android:tint="#2C3E50"/>
    <ImageView
        ...
        android:src="@drawable/xamarin_white"
        android:background="@drawable/mycircle"
        android:tint="#B4BCBC"/>
</LinearLayout>

XamarinTint2

So Much More

This is just an introduction to Material Design, but there is so much more including animations, notifications, CardView, and RecyclerView just to name a few. Be sure to check out our Android L samples on GitHub and our Android Samples page.

Discuss this post in the Xamarin forums.

TwitterFacebookGoogle+LinkedInEmail
August 25, 2014

IBM Joins Xamarin Evolve 2014

By

IBM LogoWe’re excited to announce IBM as a Diamond sponsor of Xamarin Evolve 2014. Greg Truty, Distinguished Engineer, Chief Architect SWG Mobile Build & Connect at IBM, will lead two sessions at the conference focused on how to easily build cross-platform native apps on the client-side with Xamarin, powered by the Worklight Server on the backend.

“Connecting Xamarin Apps with IBM Worklight” is a hands on session designed to show you the power of Xamarin and Worklight together. Greg will cover how to connect native Xamarin apps to IBM Worklight Server for easy integration into your enterprise’s environment, and you’ll walk away with the ability to leverage existing resources and infrastructure for mobile, as well as manage cloud-based services directly to the end-user device.

Creating a successful enterprise app that employees actually adopt into their workflow requires much more than just delivering a great UI and UX on the employee’s choice of device. It doesn’t matter how good the app is if employees don’t know about it, can’t easily get it onto their device, or if it fails to keep up with new workflow processes and/or device features that make their lives easier. Greg’s second session, “Keeping Apps Relevant: Deployment, Support, and Management Best Practices for Your Enterprise Mobile Apps,” will teach you best practices for managing the last, but not least, parts of the mobile application lifecycle.

Don’t miss your ticket to native mobile app expertise – register here to join us at Xamarin Evolve 2014 today.

TwitterFacebookGoogle+LinkedInEmail

Salesforce Joins Xamarin Evolve 2014

By

Salesforce Cloud LogoWe’re happy to announce that Salesforce will be joining the roster of amazing industry-leaders that are sponsoring and speaking at Evolve 2014, October 6-10 in Atlanta, Georgia. Join us there for the mobile development event of the year for cutting-edge enterprise content, networking, and more, including a Salesforce session from Grant Davies, founder and CEO of Bluetube Interactive, a Premier Xamarin Consulting Partner.  Grant is a seasoned Evolve speaker who co-presented the Kimberly-Clark field sales app with Kimberly-Clark at Xamarin Evolve 2013.

Grant’s talk, “The Salesforce1 Platform: The Enterprise Back-End for All Your Mobile Apps,”Grant Davies will focus on building cross-platform apps faster with Xamarin and Salesforce. You’ll learn how to easily connect Xamarin apps to the Salesforce1 Platform, a scalable enterprise back-end for mobile apps with a variety of mobile services that make apps more contextual, user-centric, engaging, secure, and scalable.

Register now to take your mobile apps to the next level with Xamarin and Salesforce at Xamarin Evolve 2014.

TwitterFacebookGoogle+LinkedInEmail
August 22, 2014

Favorite Xamarin Studio Feature Contest Winners!

By

Xamarin’s new $25 per month Indie subscriptions, brings new opportunities to get involved with Xamarin for developers around the world. Our latest contest was an opportunity to get to know more about users favorite Xamarin Studio’s features, and it’s exciting to read the different perspectives from all different types of Xamarin users.

Thank you to everyone who participated! There was one stand-out among the many contestants, and that’s Patrick Sullivan! In his blog, Patrick talks about NuGet Packet Manager, saying that, “the NuGet package manager integration into Xamarin Studio is one of the reasons I really wanted to try it out in the first place.”

Congratulations! You’ve won a 6-Month Xamarin Indie Subscription for iOS and Android.

nuget

Thank you to everyone who participated in the Favorite Xamarin Studio Feature contest! All valid entries will be receiving an exclusive Xamarin swag bag. If you didn’t manage to get an entry submitted this time, no worries; keep an eye on the Xamarin Blog for future contest announcements.

TwitterFacebookGoogle+LinkedInEmail
August 20, 2014

Amazon Joins Xamarin Evolve 2014

By

We’re excited to welcome Amazon as the first Gold Sponsor of Xamarin Evolve 2014, the must-attend event for mobile developers October 6-10 in Atlanta, Georgia. Amazon joins a growing list of industry-leading sponsors bringing great technical content, connections, and hacking opportunities to the event.

Amazon Logo

The conference line-up now includes two new technical sessions delivered by Amazon speakers David Isbitski and Tara Walker, covering Amazon Fire and Amazon Web Services.

Amazon Web Services LogoIn the “Mobile Ecosystem” track, Tara Walker, will show you how to build great mobile apps that leverage AWS Cloud services bringing identity management and data sync (Amazon Cognito), push notifications (Amazon SNS Mobile Push), cloud storage (Amazon S3), and a fully-managed NoSQL database (Amazon DynamoDB) to your mobile apps. Tara will take you on a step-by-step journey so you can see how to configure and add AWS services to your apps, and then integrate them into your backend architecture.

Amazon Fire PhoneIn the “Emerging Devices” track, David Isbitski, Worldwide Developer Evangelist for Amazon, will show you how to build native Amazon Fire Phone, Fire TV, and Kindle Fire Apps with Xamarin. This session will include both a walk-through of how to quickly use Xamarin to run your apps and games on Amazon devices, as well as an overview of how to get started and get noticed in the Amazon Appstore.

Register now to get your ticket to mobile expertise with Amazon Web Services and the Amazon Fire line of devices at Xamarin Evolve 2014!

TwitterFacebookGoogle+LinkedInEmail
August 19, 2014

Major Xamarin.Mac Updates

By

We are happy to announce a few major updates to Xamarin.Mac. The first major update is the result of more than a year of development on our API bindings and Mono’s runtime which brings the following features to Xamarin.Mac:

  • 64-bit support
  • New 64-bit Frameworks
  • Support for lighter mobile profile
  • Easier code sharing between Mac and iOS

These features are available today in the Beta channel.

Yosemite OS X Logo On top of these new features we have been hard at work binding the new Mac OS X Yosemite APIs. We are pleased to announce support for Yosemite is now available. Since Yosemite is still an unreleased platform and may continue to change you will find these APIs in the Alpha channel along with all of the other features I mentioned earlier.

64-bit support & Easier Code Sharing

We recently announced the brand new Unified API for Xamarin.iOS and Xamarin.Mac. The Unified API allows developers to support both 32 bit and 64 bit applications with the same source code (as well as binaries) on both Mac and iOS.

In addition to this we also took the time to enhance the code sharing story between iOS and Mac. An example of this is that you no longer are required to add any namespace prefixes. This means code that looked like this:

#if MAC
using MonoMac.Foundation;
#elif IOS
using MonoTouch.Foundation;
#endif

Can now simply be written in one line:

using Foundation;

For more information, read our new Guides for Cross Platform Mac and iOS code.

New 64-bit Frameworks

With the introduction of our Unified API we are finally able to support all of those 64 bit-only frameworks that Apple has introduced in the last few years, including but certainly not limited to the many new 64 bit-only frameworks in Yosemite.
What's new in scene kit

Shadows in Scene Kit

Lightweight Profile

Also with the Unified API comes the ability for users to adopt Xamarin’s Mobile profile. The Mobile profile is the same API profile that we use on Android and iOS which has been designed to be linkable and have a much smaller footprint on disk than the regular desktop edition. This is convenient for applications going into the AppStore or that wish to share more code across Android and iOS.

Samples!

Many of our Mac samples are being ported to the Unified API and currently live in their own branch. In addition, we are starting to publish our internal ports of the Yosemite samples which can be found in the Yosemite directory.

TwitterFacebookGoogle+LinkedInEmail

Unified API with 64-bit Support for iOS and Mac

By

Today we are pleased to share some major improvements to the APIs for our iOS and Mac products.

ios and osx logos

Why a new API?

The Classic Xamarin.iOS and Xamarin.Mac APIs had two major flaws:

  1. They did not support 64 bit applications.
  2. They made iOS and Mac code sharing cumbersome.

As Mac OS X evolved, more and more frameworks became available only as 64 bit frameworks. Additionally, iOS recently made the 64-bit jump when the iPhone 5s was launched.

Last year we started a redesign for our 64-bit support, one that would meet the following goals:

  1. The same source code must work on both 32 and 64-bit platforms
  2. Libraries and binaries would run either in 32 or 64 bit modes, depending on the host platform and build settings, with no source code changes or recompilation required
  3. Improved code sharing story between our Mac and iOS products.

Enter The Unified API

The result of more than a year of development on our API bindings and Mono’s runtime is our Unified API, which we are introducing today as a preview feature. The Unified API accomplishes everything we set out to and so much more.

First, we addressed the 32/64 bit split, by surfacing an API that is 32/64 bit agnostic.

Second, we dropped the namespace prefixes. This makes sharing code between iOS and Mac apps less tedious to maintain and easier on the eyes. An example to demonstrate this is what you had to do before when you had to use a using:

#if MAC
MonoMac.Foundation;
#elif IOS
MonoTouch.Foundation;
#endif

With the Unified API you can simply use:

Foundation;

64bitThis means with the new Unified API we have not only made it easier to share common code across your iOS and Mac applications, but you are now able to take advantage of all of the new 64-bit APIs on each platform.

Get Started & Backwards Compatibility

The new Unified API is available now in the Beta channel. We made the new Unified API opt-in, which means there is no need to upgrade to this new API unless you want to take advantage of the features outlined above. Xamarin will continue to support the Classic API you are familiar with for both Mac and iOS alongside the Unified API indefinitely.

We have ported all of our Mac samples and our iOS samples to the new API so you can see what is involved. They are both maintained on a branch that for historical reasons is called “magic-types”.

We are currently working on both templates to get you started (or you can migrate on your own), as well as a migration assistant that will do the bulk of the port for you.

What is Missing?

We are aware that the following features are currently missing and we are working on them:

  • Binding Project Types, to easily call into native libraries
  • Complete templates for all the scenarios previously supported
  • Xamarin’s Components are not available yet
TwitterFacebookGoogle+LinkedInEmail
August 14, 2014

Android L Developer Preview & Android Wear Support

By

Today we have published support for Google’s Android L Developer Preview in the Alpha channel. Additionally, we are introducing preliminary support for new SDKs that Google has released, including Android Wear, Android TV, and brand new Support Libraries.Android Robot

Installing our Android L Preview

  • With this release, a Java JDK 1.7 is now required to properly compile applications. You can download one for your system from Oracle website.
  • Update your Android SDK Tools to 23.0.2 from the Android SDK Manager
  • Install Android SDK Platform & Build-tools to 20

Android SDKTools

  • Download the Android L and Android 4.4W SDKs

Android L Preview SDK Download

Android Wear

Android WearWhen Google announced their new wearable platform, Android Wear, last March, they only made a new library for enhancing existing notifications available.

At Google I/O, an official developer SDK to create full-featured applications capable of running on an Android Wear device was unveiled. With this release, Xamarin developers will now enjoy the same ability.

We are also making available the Android Wear UI Library preview on NuGet to include in your wearable apps. Our Android Support Library v4 was also updated to include many of the new Android Wear interaction APIs, such as NotificationCompat and RemoteInput.

Android Support Libraries

Not only did the Android L Preview come in with a new series of core APIs, it also brought a large update to the Android Support Libraries set.

Along with Android Support Library v4 updates, additional Support Libraries are now in preview release, including great new features such as RecyclerView, CardView, Palette, Android TV Leanback, and update to Support Library v13. All of these libraries are now available straight from NuGet.

IDE Improvements

We have also added some new features to help you design for those new platforms to our Android designer for both Xamarin Studio and Visual Studio. You’ll find Wear device support, Material theme selection, and Action Bar previewing, among others, starting today.

Android Wear Designer support

See the Xamarin Studio release notes for more information and known caveats.

Getting Started

You should have the new APIs available now. Check our release notes for more details and a detailed list of the new APIs.

TwitterFacebookGoogle+LinkedInEmail