16
Jonathan Pryor Xamarin.Android Lead Xamarin [email protected] What’s New in Xamarin.Android

What's new in xamarin.android, Jonathan Pryor

  • Upload
    xamarin

  • View
    1.053

  • Download
    2

Embed Size (px)

Citation preview

Page 1: What's new in xamarin.android, Jonathan Pryor

Jonathan PryorXamarin.Android LeadXamarin

[email protected]

What’s New inXamarin.Android

Page 2: What's new in xamarin.android, Jonathan Pryor

What’s in Xamarin.Android

IDERuntimeJava library bindingPackagingUnified Components

•••••

Page 3: What's new in xamarin.android, Jonathan Pryor

Visual Studio

Layout EditorNon-Modal Deployment

Target Selection

••

Released

Page 4: What's new in xamarin.android, Jonathan Pryor

Xamarin Studio

Layout EditorRazor HTML Generator

••

Released

Page 5: What's new in xamarin.android, Jonathan Pryor

Runtime: New Foundation

Mono 3.0 base, includes most .NET 4.5 APIsStream.ReadAsync(), System.Net.Http.dll“Breaking” Change on OS X:new Java.Lang.Object() // CS1540

Xamarin.Android ≤ 4.6: “Silverlight” basedXamarin.Android ≥ 4.7: .NET 4.5-based -

System.Configuration

••

••

Beta

Page 6: What's new in xamarin.android, Jonathan Pryor

01020304050607080910111213141516

Runtime: C#4 Dynamicvar books = @"<books pubdate='2009-05-20'> <book price='45.99' title='Open Heart Surgery for Dummies'> <authors> <author> <name><first>Mortimer</first><last>Snerdly</last></name> <email address='[email protected]'/> </author> </authors> </book></book>";dynamic dx = new DynamicXml(books);Console.WriteLine("Book list publication date='{0}'", dx.pubdate.Value);Console.WriteLine(" Book count='{0}'", dx.book.Count);Console.WriteLine(" first book title='{0}'", dx.book[0].title.Value);Console.WriteLine(" first book price='{0}'", dx.book[0].price.Value);Console.WriteLine(" first book authors count='{0}'", dx.book[0].author.Count);// Output:// Book list publication date='2009-05-20'// Book count='1'// first book title='Open Heart Surgery for Dummies'// first book price='45.99'// first book authors count='1'

http://blogs.captechconsulting.com/blog/kevin-hazzard/fluent-xml-parsing-using-cs-dynamic-type-part-1

Released

Page 7: What's new in xamarin.android, Jonathan Pryor

01020304050607080910111213141516

Runtime: C#4 Variant Genericsinterface IEnumerable<out T> : IEnumerable { new IEnumerator<T> GetEnumerator ();}interface IEnumerator<out T> : IDisposable, IEnumerator { new T Current {get;}}void Cat (IEnumerable<Stream> streams, Stream destination){ foreach (var stream in streams) stream.CopyTo (destination);}Cat (new List<MemoryStream> {}, Stream.Null); // CS0266 in C#3Cat (new List<FileStream> {}, Stream.Null); // CS0266 in C#3

Beta

Page 8: What's new in xamarin.android, Jonathan Pryor

01020304050607080910111213141516

Runtime: C# < 5// Old and bustedGetUserAsync ("migueldeicaza").ContinueWith (t => PostStatusAsync (t.Result, "Having an awesome time at #Xamarin Evolve!")).Unwrap().ContinueWith (t => { if (t.IsFaulted) { ShowError (t.Exception.Flatten().InnerException); return; } UpdateUI();}, TaskScheduler.FromCurrentSynchronizationContext());

Released

Page 9: What's new in xamarin.android, Jonathan Pryor

01020304050607080910111213141516

Runtime: C#5 Async// New Hawtnesstry { var user = await GetUserAsync ("migueldeicaza"); await PostStatusAsync (user, "Having an awesome time at #Xamarin Evolve!"); UpdateUI();}catch (Exception ex) { ShowError (ex);}

Beta

Page 10: What's new in xamarin.android, Jonathan Pryor

Runtime: New Features

New default ARM ABI: armeabi-v7a (armv7)F# supportProfiling [Beta!]

$ adb shell setprop \ debug.mono.profile log:sample# Run app on device...$ adb pull \ /data/.../files/.__override__/profile.mlpd$ mprof-report profile.mlpd | less

•••

Beta

Released

Page 11: What's new in xamarin.android, Jonathan Pryor

Binding Improvements

Expose more of the Java APIEmbed Java libraries into assemblies

Build action: EmbeddedJar, EmbeddedReferenceJarJava Library Project support

project.properties file(Build action: LibraryProjectProperties)library.zip file(Build action: LibraryProjectZip)

••

••

Beta

Released

Released

Page 12: What's new in xamarin.android, Jonathan Pryor

What’s new in App Packaging?

Native library remapping (provide .dll.config)Bundle assemblies into native codeSatellite AssembliesEnvironment support (Build action: AndroidEnvironment)

# CommentsENV_VAR=env-valuedebug.mono.log=grefdebug.mono.env=MONO_LOG_LEVEL=debug

•••• Released

Beta

Beta

Page 13: What's new in xamarin.android, Jonathan Pryor

Packaging: Library Resources

Library project assemblies may contain:Android Resources (Build action: AndroidResource)Native libraries (Build action: EmbeddedNativeLibrary)

Problem: default Library template may not support AndroidResources.Solution: Hack it

Create a new Android Application projectEdit .csprojRemove <AndroidApplication/> element.Reopen project.

•••

•1.2.3.4.

Beta

Released

Page 14: What's new in xamarin.android, Jonathan Pryor

01020304050607080910111213141516

Packaging: [Export]<!-- Resources\layout\Main.axml --><Button android:id="@+id/myButton" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" android:onClick="MyButton_OnClick" />// MyActivity.csnamespace MyApp { public partial class MyActivity : Activity { [Java.Interop.Export] public void MyButton_OnClick (View view) { ((Button) view).Text = "clicked!"; } }}

Released

Page 15: What's new in xamarin.android, Jonathan Pryor

01020304050607080910111213141516

Packaging: AndroidInterfaceDescription// AIDLpackage com.android.vending.billing;import android.os.Bundle;interface IMarketBillingService { /** Given the arguments in bundle form, returns a bundle for results. */ Bundle sendBillingRequest(in Bundle bundle);}

// C# generated codeinterface IMarketBillingService : Android.OS.IInterface { Android.OS.Bundle SendBillingRequest (Android.OS.Bundle bundle);}abstract class IMarketBillingServiceStub : Binder, IInterface, IMarketBillingService { public abstract Bundle SendBillingRequest (Bundle bundle); public partial class Proxy : Java.Lang.Object, IMarketBillingService {}}

Released

Page 16: What's new in xamarin.android, Jonathan Pryor

Unified Components

Component Assembly may contain:ECMA CIL (code)ECMA Resources (Build action: EmbeddedResource)Android Resources (Build action: AndroidResource)Native libraries

Allows entire components to be shipped as single assembly, likeXamarin.iOS

••

Released

Released

Released

Beta