10 must-use components for your mobile apps, james clancey

32
James Clancey Senior Mobile Developer Xamarin [email protected] Must-use App Components @jtclancey

Upload: xamarin

Post on 10-May-2015

1.399 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: 10 Must-Use Components for Your Mobile Apps, James Clancey

James ClanceySenior Mobile [email protected]

Must-use App Components

@jtclancey

Page 2: 10 Must-Use Components for Your Mobile Apps, James Clancey

Component Store with IDE Integration

Page 3: 10 Must-Use Components for Your Mobile Apps, James Clancey

Radial Progress• Stylish animated progress view

Page 4: 10 Must-Use Components for Your Mobile Apps, James Clancey

Radial Progress• Stylish animated progress view• Same API on iOS, Android

Page 5: 10 Must-Use Components for Your Mobile Apps, James Clancey

Radial Progress• Stylish animated progress view• Same API on iOS, Android• Perfect for background tasks

Page 6: 10 Must-Use Components for Your Mobile Apps, James Clancey

0102030405060708091011121314

Radial Progress Sample Usage

using RadialProgress;

public override void ViewDidLoad(){ base.ViewDidLoad();! ! var progressView = new RadialProgressView { Center = new PointF (View.Center.X, View.Center.Y - 100) }; View.AddSubview (progressView);

// Update the progress progressView.Value = 0.46f;}

Page 7: 10 Must-Use Components for Your Mobile Apps, James Clancey

Json.NET

• LINQ-to-JSON for custom JSON parsing and output

Page 8: 10 Must-Use Components for Your Mobile Apps, James Clancey

Json.NET

• LINQ-to-JSON for custom JSON parsing and output• Faster than .NET's built-in JSON serializers

Page 9: 10 Must-Use Components for Your Mobile Apps, James Clancey

Json.NET

• LINQ-to-JSON for custom JSON parsing and output• Faster than .NET's built-in JSON serializers• Also converts JSON to and from XML

Page 10: 10 Must-Use Components for Your Mobile Apps, James Clancey

Json.net01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

16

public class Person{ public string Name { get; set; }

public DateTime Birthday { get; set; }}

public Person ParsePerson (string jsonString){ var person = JsonConvert.DeserializeObject<Person>(jsonString); return person;}

Page 11: 10 Must-Use Components for Your Mobile Apps, James Clancey

ZXing.Net.Mobile is a C#/.NET Barcode Scanning LibraryZXing.Net.Mobile

Page 12: 10 Must-Use Components for Your Mobile Apps, James Clancey

ZXing.Net.Mobile

• Open Source• Simple API• Cross platform

iOSAndroidWindows Phone

• Custom Overlays

Page 13: 10 Must-Use Components for Your Mobile Apps, James Clancey

01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

16

ZXing.Net.Mobilepublic void Scan ()

{! var scanner = new ZXing.Mobile.MobileBarcodeScanner ();! scanner.Scan ().ContinueWith (t => { ! ! if (t.Result != null)! ! ! Console.WriteLine ("Scanned Barcode: " + t.Result.Text);! } );!}

Page 14: 10 Must-Use Components for Your Mobile Apps, James Clancey

Dropbox

• API handles all the caching, retrying, and file change notifications.

Page 15: 10 Must-Use Components for Your Mobile Apps, James Clancey

Dropbox

• API handles all the caching, retrying, and file change notifications.

• Writes are local so changes are immediate. The Sync API syncs to Dropbox behind the scenes.

Page 16: 10 Must-Use Components for Your Mobile Apps, James Clancey

Dropbox

• API handles all the caching, retrying, and file change notifications.

• Writes are local so changes are immediate. The Sync API syncs to Dropbox behind the scenes.

• Your app works great even when offline and automatically syncs when it's back online.

Page 17: 10 Must-Use Components for Your Mobile Apps, James Clancey

01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

16

Dropbox Syncvoid ListFiles (string path)

{! ! DBError error;

! ! var contents = DBFilesystem.SharedFilesystem.ListFolder (path, out error);! ! foreach (DBFileInfo info in contents) {! ! ! Console.WriteLine (info.Path);! ! } }

Page 18: 10 Must-Use Components for Your Mobile Apps, James Clancey

• By Zetetic LLC• 256-bit AES encryption of SQLite database files

SQLCipher

Page 19: 10 Must-Use Components for Your Mobile Apps, James Clancey

01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

16

SQLCipherpublic class Model

{! [PrimaryKey,AutoIncrement]! public int Id { get; set; }! public string Content { get; set; }}

using(var conn = new SQLiteConnection (FilePath, Password)){! var model = conn.Table<Model>().Where(x=> x.Id = 0)}

Page 20: 10 Must-Use Components for Your Mobile Apps, James Clancey

01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

16

SQLCipherpublic void SqlCipherDemo ()

{! using (var connection = new Mono.Data.Sqlcipher.SqliteConnection(connectionString)) {! ! connection.SetPassword ("secretPassword");! ! connection.Open ();

! ! using (var command = connection.CreateCommand()) {! ! ! var query = "select * from t1";! ! ! command.CommandText = query;! ! ! var reader = command.ExecuteReader ();! ! ! while (reader.Read()) {! ! ! ! //Read Values! ! ! }! ! }! ! connection.Close ();! }}

Page 21: 10 Must-Use Components for Your Mobile Apps, James Clancey

Mobile Services by Windows Azure

• By Microso"• Easily store data in the cloud• Managed C#• Cross Platform

iOSAndroidWindows

• Async

Page 22: 10 Must-Use Components for Your Mobile Apps, James Clancey

01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

16

Mobile Services by Windows Azurepublic class Item

{! ! public int Id { get; set; }! ! public string Text { get; set; }}

Item item = new Item { Text = "Awesome item" };! ! ! App.MobileService.GetTable<Item> ().InsertAsync (item)! ! ! ! .ContinueWith (t => {! ! ! /* success or failure */} );

Page 23: 10 Must-Use Components for Your Mobile Apps, James Clancey

by ShinobiBlazing fast charts!

ShinobiCharts

Page 24: 10 Must-Use Components for Your Mobile Apps, James Clancey

Xamarin.Social

• Cross PlatformiOSAndroid

• Share Text or Images• Twitter• Facebook• Flickr• App.net• Pinterest

Page 25: 10 Must-Use Components for Your Mobile Apps, James Clancey

01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

16

Xamarin.Social// 1. Create the service

var facebook = new FacebookService {! ClientId = "<App ID from developers.facebook.com/apps>",! RedirectUrl = new System.Uri ("<Redirect URL from developers.facebook.com/apps>")};

// 2. Create an item to sharevar item = new Item { Text = "Xamarin.Social is the bomb.com." };item.Links.Add (new Uri ("http://github.com/xamarin/xamarin.social"));

// 3. Present the UI on iOSvar shareController = facebook.GetShareUI (item, result => {! // result lets you know if the user shared the item or canceled! DismissViewController (true, null);});PresentViewController (shareController, true, null);

Page 26: 10 Must-Use Components for Your Mobile Apps, James Clancey

Signature Pad

• Very simple API• Save/Load Vectors• Export Image

Page 27: 10 Must-Use Components for Your Mobile Apps, James Clancey

01020304050607080910111213141516

Signature Padvar signature = new SignaturePadView (View.Frame);

View.AddSubview (signature);

//Get the signaturevar image = signature.GetImage ();ViewController (shareController, true, null);

Page 28: 10 Must-Use Components for Your Mobile Apps, James Clancey

Xamarin.Mobile

• Cross platformiOSAndroidWindows

• GeoLocation• Contacts• Media Picker

Page 29: 10 Must-Use Components for Your Mobile Apps, James Clancey

01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

16

Xamarin.Mobilevar locator = new Geolocator { DesiredAccuracy = 50 };

locator.GetPositionAsync (timeout: 10000).ContinueWith (t => {! Console.WriteLine ("Position Status: {0}", t.Result.Timestamp);! Console.WriteLine ("Position Latitude: {0}", t.Result.Latitude);! Console.WriteLine ("Position Longitude: {0}", t.Result.Longitude);}, TaskScheduler.FromCurrentSynchronizationContext ());

Page 30: 10 Must-Use Components for Your Mobile Apps, James Clancey

Q&A

Page 31: 10 Must-Use Components for Your Mobile Apps, James Clancey

DEMO

Page 32: 10 Must-Use Components for Your Mobile Apps, James Clancey

THANK YOUJames [email protected]

@jtclancey