SlideShare uma empresa Scribd logo
1 de 48
Xamarin.Mobile
Accessing Unified Cross-Platform Features




               June 14, 2012

            Copyright 2012 © Xamarin Inc. All rights reserved
Agenda
Xamarin.Mobile

                   Mike Bluestein
                   Technical Writer
                   Xamarin Documentation Team
                   mike.bluestein@xamarin.com
                   @mikebluestein




                                                    Xamarin
Copyright 2012 © Xamarin Inc. All rights reserved
Xamarin.Mobile
Xamarin.Mobile

• Cross Platform API
Xamarin.Mobile

• Cross Platform API
 • MonoTouch
Xamarin.Mobile

• Cross Platform API
 • MonoTouch
 • Mono for Android
Xamarin.Mobile

• Cross Platform API
 • MonoTouch
 • Mono for Android
 • Windows Phone 7
Architecture
Architecture

   Xamarin.Mobile
Architecture

              Xamarin.Mobile




Contacts
Architecture

                         Xamarin.Mobile




Contacts   Geolocation
Architecture

                         Xamarin.Mobile




                          Compass +
Contacts   Geolocation
                         Accelerometer
Architecture

                         Xamarin.Mobile




                          Compass +
Contacts   Geolocation                    Camera
                         Accelerometer
Architecture

                         Xamarin.Mobile




                          Compass +
Contacts   Geolocation                    Camera   Notifications
                         Accelerometer
Xamarin.Mobile Contacts
Xamarin.Mobile Contacts

 • Maps to native implementation on each
   platform
Xamarin.Mobile Contacts

 • Maps to native implementation on each
   platform
 • AddressBook implements IQueryable
Xamarin.Mobile Contacts

 • Maps to native implementation on each
   platform
 • AddressBook implements IQueryable
 • LINQ
Contacts - Android
ContentResolver content= getContentResolver();

Cursor ncursor = null;
try {
    ncursor = content.query (ContactsContract.Data.CONTENT_URI,
        new String[] { ContactsContract.Data.MIMETYPE, ContactsContract.Contacts.LOOKUP_KEY, ContactsContract.Contacts.DISPLAY_NAME },
        ContactsContract.Data.MIMETYPE + "=? AND " + ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME + "=?",
        new String[] { ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE, "Smith" }, null);

    while (ncursor.moveToNext()) {
        print (ncursor.getString(ncursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)) + lineSep);

        String lookupKey = ncursor.getString (ncursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
        Cursor dcursor = null;
        try {
            dcursor = content.query (ContactsContract.Data.CONTENT_URI,
                    new String[] { ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Phone.NUMBER,
                         ContactsContract.Data.DATA1 },
                    ContactsContract.Contacts.LOOKUP_KEY + "=?", new String[] { lookupKey }, null);
            while (dcursor.moveToNext()) {
                String type = dcursor.getString (ncursor.getColumnIndex(ContactsContract.Data.MIMETYPE));

                if (type.equals (ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE))
                    print ("Phone: " + dcursor.getString(dcursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)) +
                         lineSep);
                else if (type.equals (ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE))
                    print ("Email: " + dcursor.getString(dcursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA1)) +
                         lineSep);
            }
        } finally {
            if (dcursor != null)
                dcursor.close();
        }
    }
} finally {
    if (ncursor != null)
        ncursor.close();
}
Contacts - iOS
ABAddressBookRef ab = ABAddressBookCreate();
CFStringRef name = CFSTR ("Smith");
CFArrayRef smiths = ABAddressBookCopyPeopleWithName(ab, name);
CFRelease (name);

int count = CFArrayGetCount(smiths);
for (int i = 0; i < count; ++i) {
    ABRecordRef person = (ABRecordRef)CFArrayGetValueAtIndex(smiths, (CFIndex)i);
    if (ABRecordGetRecordType(person) != kABPersonType)
        continue;

    NSString *name = (NSString*)ABRecordCopyCompositeName(person);
    NSLog ("%@n", name);
    [name release];

    ABMultiValueRef phoneNumberProp = ABRecordCopyValue(person, kABPersonPhoneProperty);
    NSArray* numbers = (NSArray*)ABMultiValueCopyArrayOfAllValues(phoneNumberProp);
    CFRelease(phoneNumberProp);

    for (NSString *pvalue in numbers)
         NSLog ("Phone: %@n", pvalue);

    [numbers release];

    ABMultiValueRef emailProp = ABRecordCopyValue(person, kABPersonEmailProperty);
    NSArray* emails = (NSArray*)ABMultiValueCopyArrayOfAllValues(emailProp);
    CFRelease(emailProp);

    for (NSString *evalue in emails)
        NSLog ("Email: %@n");
    [emails release];
}
CFRelease (ab);
CFRelease (smiths);
Xamarin.Mobile Contacts
Xamarin.Mobile Contacts

     var book = new AddressBook () {
         PreferContactAggregation = true
     } ;

     foreach (Contact c in book.Where (c => c.LastName == "Smith")) {
         Console.WriteLine (c.DisplayName);

         foreach (Phone p in c.Phones)
             Console.WriteLine ("Phone: " + p.Number);

         foreach (Email e in c.Emails)
             Console.WriteLine ("Email: " + e.Address);
     }
Contacts
MediaPicker
MediaPicker

• Take Photos and Videos
MediaPicker

• Take Photos and Videos
• Select Photos and Videos
MediaPicker

• Take Photos and Videos
• Select Photos and Videos
• Programmatic feature detection
MediaPicker

• Take Photos and Videos
• Select Photos and Videos
• Programmatic feature detection
 • MediaPicker.PhotosSupported
MediaPicker

• Take Photos and Videos
• Select Photos and Videos
• Programmatic feature detection
 • MediaPicker.PhotosSupported
 • MediaPicker.VideosSupported
Selecting Photos
Selecting Photos

var picker = new MediaPicker ();
picker.PickPhotoAsync ()
     .ContinueWith (t =>
     {
          if (t.IsCanceled || t.IsFaulted) // user cancelled or error
               return;
          Bitmap b = BitmapFactory.DecodeFile (t.Result.Path);
          RunOnUiThread (() => platformImage.SetImageBitmap (b));
     });
Selecting Photos

var picker = new MediaPicker ();
picker.PickPhotoAsync ()
     .ContinueWith (t =>
     {
          if (t.IsCanceled || t.IsFaulted) // user cancelled or error
               return;
          Bitmap b = BitmapFactory.DecodeFile (t.Result.Path);
          RunOnUiThread (() => platformImage.SetImageBitmap (b));
     });
Taking Photos or Videos
Taking Photos or Videos

• Specify which camera to use
Taking Photos or Videos

• Specify which camera to use
• Query for camera availability
Taking Photos or Videos

• Specify which camera to use
• Query for camera availability
• Specify video quality
Taking Photos or Videos

• Specify which camera to use
• Query for camera availability
• Specify video quality
• Async and C# TPL Compatible
Taking Photos or Videos

• Specify which camera to use
• Query for camera availability
• Specify video quality
• Async and C# TPL Compatible
 • Task.ContinueWith, IsCancelled, IsFaulted
Taking Photos or Videos

    if (!picker.IsCameraAvailable)
        return;
    VideoView videoView = FindViewById<VideoView> (Resource.Id.video);
    picker.TakeVideoAsync (new StoreVideoOptions
    {
          Directory = "Xamovies",
          DefaultCamera = CameraDevice.Front,
          DesiredLength = TimeSpan.FromMinutes (5)
    })
    .ContinueWith (t =>
    {
          if (t.IsCanceled || t.IsFaulted) // user cancelled or error
                return;
          videoView.SetVideoPath (t.Result.Path);
    });
MediaPicker
Geolocation
Geolocation

• Geolocator class
Geolocation

• Geolocator class
• Retrieve current location
Geolocation

• Geolocator class
• Retrieve current location
• Listen for Location changes
Geolocation

• Geolocator class
• Retrieve current location
• Listen for Location changes
• DesiredAccuracy influences the location
  technology that is used
Geolocation
Resources

• http://xamarin.com/mobileapi
• Download:
  http://xamarin.com/xamarinmobileapipreview.zip

• API Docs:
  http://betaapi.xamarin.com/?link=root:/Xamarin.Mobile
Xamarin
    Seminar
   Please give us your feedback
  http://bit.ly/xamfeedback


      Follow us on Twitter
        @XamarinHQ



        Copyright 2012 © Xamarin Inc. All rights reserved

Mais conteúdo relacionado

Mais de Xamarin

Build Better Games with Unity and Microsoft Azure
Build Better Games with Unity and Microsoft AzureBuild Better Games with Unity and Microsoft Azure
Build Better Games with Unity and Microsoft AzureXamarin
 
Exploring UrhoSharp 3D with Xamarin Workbooks
Exploring UrhoSharp 3D with Xamarin WorkbooksExploring UrhoSharp 3D with Xamarin Workbooks
Exploring UrhoSharp 3D with Xamarin WorkbooksXamarin
 
Desktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin
Desktop Developer’s Guide to Mobile with Visual Studio Tools for XamarinDesktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin
Desktop Developer’s Guide to Mobile with Visual Studio Tools for XamarinXamarin
 
Developer’s Intro to Azure Machine Learning
Developer’s Intro to Azure Machine LearningDeveloper’s Intro to Azure Machine Learning
Developer’s Intro to Azure Machine LearningXamarin
 
Customizing Xamarin.Forms UI
Customizing Xamarin.Forms UICustomizing Xamarin.Forms UI
Customizing Xamarin.Forms UIXamarin
 
Session 4 - Xamarin Partner Program, Events and Resources
Session 4 - Xamarin Partner Program, Events and ResourcesSession 4 - Xamarin Partner Program, Events and Resources
Session 4 - Xamarin Partner Program, Events and ResourcesXamarin
 
Session 3 - Driving Mobile Growth and Profitability
Session 3 - Driving Mobile Growth and ProfitabilitySession 3 - Driving Mobile Growth and Profitability
Session 3 - Driving Mobile Growth and ProfitabilityXamarin
 
Session 2 - Emerging Technologies in your Mobile Practice
Session 2 - Emerging Technologies in your Mobile PracticeSession 2 - Emerging Technologies in your Mobile Practice
Session 2 - Emerging Technologies in your Mobile PracticeXamarin
 
Session 1 - Transformative Opportunities in Mobile and Cloud
Session 1 - Transformative Opportunities in Mobile and Cloud Session 1 - Transformative Opportunities in Mobile and Cloud
Session 1 - Transformative Opportunities in Mobile and Cloud Xamarin
 
SkiaSharp Graphics for Xamarin.Forms
SkiaSharp Graphics for Xamarin.FormsSkiaSharp Graphics for Xamarin.Forms
SkiaSharp Graphics for Xamarin.FormsXamarin
 
Building Games for iOS, macOS, and tvOS with Visual Studio and Azure
Building Games for iOS, macOS, and tvOS with Visual Studio and AzureBuilding Games for iOS, macOS, and tvOS with Visual Studio and Azure
Building Games for iOS, macOS, and tvOS with Visual Studio and AzureXamarin
 
Intro to Xamarin.Forms for Visual Studio 2017
Intro to Xamarin.Forms for Visual Studio 2017Intro to Xamarin.Forms for Visual Studio 2017
Intro to Xamarin.Forms for Visual Studio 2017Xamarin
 
Connected Mobile Apps with Microsoft Azure
Connected Mobile Apps with Microsoft AzureConnected Mobile Apps with Microsoft Azure
Connected Mobile Apps with Microsoft AzureXamarin
 
Introduction to Xamarin for Visual Studio 2017
Introduction to Xamarin for Visual Studio 2017Introduction to Xamarin for Visual Studio 2017
Introduction to Xamarin for Visual Studio 2017Xamarin
 
Building Your First iOS App with Xamarin for Visual Studio
Building Your First iOS App with Xamarin for Visual StudioBuilding Your First iOS App with Xamarin for Visual Studio
Building Your First iOS App with Xamarin for Visual StudioXamarin
 
Building Your First Android App with Xamarin
Building Your First Android App with XamarinBuilding Your First Android App with Xamarin
Building Your First Android App with XamarinXamarin
 
Building Your First Xamarin.Forms App
Building Your First Xamarin.Forms AppBuilding Your First Xamarin.Forms App
Building Your First Xamarin.Forms AppXamarin
 
Intro to Xamarin for Visual Studio: Native iOS, Android, and Windows Apps in C#
Intro to Xamarin for Visual Studio: Native iOS, Android, and Windows Apps in C#Intro to Xamarin for Visual Studio: Native iOS, Android, and Windows Apps in C#
Intro to Xamarin for Visual Studio: Native iOS, Android, and Windows Apps in C#Xamarin
 
Xamarin Mobile Leaders Summit | Solving the Unique Challenges in Mobile DevOps
Xamarin Mobile Leaders Summit | Solving the Unique Challenges in Mobile DevOpsXamarin Mobile Leaders Summit | Solving the Unique Challenges in Mobile DevOps
Xamarin Mobile Leaders Summit | Solving the Unique Challenges in Mobile DevOpsXamarin
 
Xamarin Mobile Leaders Summit: The Mobile Mind Shift: Opportunities, Challeng...
Xamarin Mobile Leaders Summit: The Mobile Mind Shift: Opportunities, Challeng...Xamarin Mobile Leaders Summit: The Mobile Mind Shift: Opportunities, Challeng...
Xamarin Mobile Leaders Summit: The Mobile Mind Shift: Opportunities, Challeng...Xamarin
 

Mais de Xamarin (20)

Build Better Games with Unity and Microsoft Azure
Build Better Games with Unity and Microsoft AzureBuild Better Games with Unity and Microsoft Azure
Build Better Games with Unity and Microsoft Azure
 
Exploring UrhoSharp 3D with Xamarin Workbooks
Exploring UrhoSharp 3D with Xamarin WorkbooksExploring UrhoSharp 3D with Xamarin Workbooks
Exploring UrhoSharp 3D with Xamarin Workbooks
 
Desktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin
Desktop Developer’s Guide to Mobile with Visual Studio Tools for XamarinDesktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin
Desktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin
 
Developer’s Intro to Azure Machine Learning
Developer’s Intro to Azure Machine LearningDeveloper’s Intro to Azure Machine Learning
Developer’s Intro to Azure Machine Learning
 
Customizing Xamarin.Forms UI
Customizing Xamarin.Forms UICustomizing Xamarin.Forms UI
Customizing Xamarin.Forms UI
 
Session 4 - Xamarin Partner Program, Events and Resources
Session 4 - Xamarin Partner Program, Events and ResourcesSession 4 - Xamarin Partner Program, Events and Resources
Session 4 - Xamarin Partner Program, Events and Resources
 
Session 3 - Driving Mobile Growth and Profitability
Session 3 - Driving Mobile Growth and ProfitabilitySession 3 - Driving Mobile Growth and Profitability
Session 3 - Driving Mobile Growth and Profitability
 
Session 2 - Emerging Technologies in your Mobile Practice
Session 2 - Emerging Technologies in your Mobile PracticeSession 2 - Emerging Technologies in your Mobile Practice
Session 2 - Emerging Technologies in your Mobile Practice
 
Session 1 - Transformative Opportunities in Mobile and Cloud
Session 1 - Transformative Opportunities in Mobile and Cloud Session 1 - Transformative Opportunities in Mobile and Cloud
Session 1 - Transformative Opportunities in Mobile and Cloud
 
SkiaSharp Graphics for Xamarin.Forms
SkiaSharp Graphics for Xamarin.FormsSkiaSharp Graphics for Xamarin.Forms
SkiaSharp Graphics for Xamarin.Forms
 
Building Games for iOS, macOS, and tvOS with Visual Studio and Azure
Building Games for iOS, macOS, and tvOS with Visual Studio and AzureBuilding Games for iOS, macOS, and tvOS with Visual Studio and Azure
Building Games for iOS, macOS, and tvOS with Visual Studio and Azure
 
Intro to Xamarin.Forms for Visual Studio 2017
Intro to Xamarin.Forms for Visual Studio 2017Intro to Xamarin.Forms for Visual Studio 2017
Intro to Xamarin.Forms for Visual Studio 2017
 
Connected Mobile Apps with Microsoft Azure
Connected Mobile Apps with Microsoft AzureConnected Mobile Apps with Microsoft Azure
Connected Mobile Apps with Microsoft Azure
 
Introduction to Xamarin for Visual Studio 2017
Introduction to Xamarin for Visual Studio 2017Introduction to Xamarin for Visual Studio 2017
Introduction to Xamarin for Visual Studio 2017
 
Building Your First iOS App with Xamarin for Visual Studio
Building Your First iOS App with Xamarin for Visual StudioBuilding Your First iOS App with Xamarin for Visual Studio
Building Your First iOS App with Xamarin for Visual Studio
 
Building Your First Android App with Xamarin
Building Your First Android App with XamarinBuilding Your First Android App with Xamarin
Building Your First Android App with Xamarin
 
Building Your First Xamarin.Forms App
Building Your First Xamarin.Forms AppBuilding Your First Xamarin.Forms App
Building Your First Xamarin.Forms App
 
Intro to Xamarin for Visual Studio: Native iOS, Android, and Windows Apps in C#
Intro to Xamarin for Visual Studio: Native iOS, Android, and Windows Apps in C#Intro to Xamarin for Visual Studio: Native iOS, Android, and Windows Apps in C#
Intro to Xamarin for Visual Studio: Native iOS, Android, and Windows Apps in C#
 
Xamarin Mobile Leaders Summit | Solving the Unique Challenges in Mobile DevOps
Xamarin Mobile Leaders Summit | Solving the Unique Challenges in Mobile DevOpsXamarin Mobile Leaders Summit | Solving the Unique Challenges in Mobile DevOps
Xamarin Mobile Leaders Summit | Solving the Unique Challenges in Mobile DevOps
 
Xamarin Mobile Leaders Summit: The Mobile Mind Shift: Opportunities, Challeng...
Xamarin Mobile Leaders Summit: The Mobile Mind Shift: Opportunities, Challeng...Xamarin Mobile Leaders Summit: The Mobile Mind Shift: Opportunities, Challeng...
Xamarin Mobile Leaders Summit: The Mobile Mind Shift: Opportunities, Challeng...
 

Último

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Último (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

Xamarin.Mobile - Accessing Unified Cross-platform Features with Mike Bluestein

  • 1. Xamarin.Mobile Accessing Unified Cross-Platform Features June 14, 2012 Copyright 2012 © Xamarin Inc. All rights reserved
  • 2. Agenda Xamarin.Mobile Mike Bluestein Technical Writer Xamarin Documentation Team mike.bluestein@xamarin.com @mikebluestein Xamarin Copyright 2012 © Xamarin Inc. All rights reserved
  • 6. Xamarin.Mobile • Cross Platform API • MonoTouch • Mono for Android
  • 7. Xamarin.Mobile • Cross Platform API • MonoTouch • Mono for Android • Windows Phone 7
  • 9. Architecture Xamarin.Mobile
  • 10. Architecture Xamarin.Mobile Contacts
  • 11. Architecture Xamarin.Mobile Contacts Geolocation
  • 12. Architecture Xamarin.Mobile Compass + Contacts Geolocation Accelerometer
  • 13. Architecture Xamarin.Mobile Compass + Contacts Geolocation Camera Accelerometer
  • 14. Architecture Xamarin.Mobile Compass + Contacts Geolocation Camera Notifications Accelerometer
  • 16. Xamarin.Mobile Contacts • Maps to native implementation on each platform
  • 17. Xamarin.Mobile Contacts • Maps to native implementation on each platform • AddressBook implements IQueryable
  • 18. Xamarin.Mobile Contacts • Maps to native implementation on each platform • AddressBook implements IQueryable • LINQ
  • 19. Contacts - Android ContentResolver content= getContentResolver(); Cursor ncursor = null; try { ncursor = content.query (ContactsContract.Data.CONTENT_URI, new String[] { ContactsContract.Data.MIMETYPE, ContactsContract.Contacts.LOOKUP_KEY, ContactsContract.Contacts.DISPLAY_NAME }, ContactsContract.Data.MIMETYPE + "=? AND " + ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME + "=?", new String[] { ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE, "Smith" }, null); while (ncursor.moveToNext()) { print (ncursor.getString(ncursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)) + lineSep); String lookupKey = ncursor.getString (ncursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY)); Cursor dcursor = null; try { dcursor = content.query (ContactsContract.Data.CONTENT_URI, new String[] { ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Phone.NUMBER, ContactsContract.Data.DATA1 }, ContactsContract.Contacts.LOOKUP_KEY + "=?", new String[] { lookupKey }, null); while (dcursor.moveToNext()) { String type = dcursor.getString (ncursor.getColumnIndex(ContactsContract.Data.MIMETYPE)); if (type.equals (ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE)) print ("Phone: " + dcursor.getString(dcursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)) + lineSep); else if (type.equals (ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE)) print ("Email: " + dcursor.getString(dcursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA1)) + lineSep); } } finally { if (dcursor != null) dcursor.close(); } } } finally { if (ncursor != null) ncursor.close(); }
  • 20. Contacts - iOS ABAddressBookRef ab = ABAddressBookCreate(); CFStringRef name = CFSTR ("Smith"); CFArrayRef smiths = ABAddressBookCopyPeopleWithName(ab, name); CFRelease (name); int count = CFArrayGetCount(smiths); for (int i = 0; i < count; ++i) { ABRecordRef person = (ABRecordRef)CFArrayGetValueAtIndex(smiths, (CFIndex)i); if (ABRecordGetRecordType(person) != kABPersonType) continue; NSString *name = (NSString*)ABRecordCopyCompositeName(person); NSLog ("%@n", name); [name release]; ABMultiValueRef phoneNumberProp = ABRecordCopyValue(person, kABPersonPhoneProperty); NSArray* numbers = (NSArray*)ABMultiValueCopyArrayOfAllValues(phoneNumberProp); CFRelease(phoneNumberProp); for (NSString *pvalue in numbers) NSLog ("Phone: %@n", pvalue); [numbers release]; ABMultiValueRef emailProp = ABRecordCopyValue(person, kABPersonEmailProperty); NSArray* emails = (NSArray*)ABMultiValueCopyArrayOfAllValues(emailProp); CFRelease(emailProp); for (NSString *evalue in emails) NSLog ("Email: %@n"); [emails release]; } CFRelease (ab); CFRelease (smiths);
  • 22. Xamarin.Mobile Contacts var book = new AddressBook () { PreferContactAggregation = true } ; foreach (Contact c in book.Where (c => c.LastName == "Smith")) { Console.WriteLine (c.DisplayName); foreach (Phone p in c.Phones) Console.WriteLine ("Phone: " + p.Number); foreach (Email e in c.Emails) Console.WriteLine ("Email: " + e.Address); }
  • 26. MediaPicker • Take Photos and Videos • Select Photos and Videos
  • 27. MediaPicker • Take Photos and Videos • Select Photos and Videos • Programmatic feature detection
  • 28. MediaPicker • Take Photos and Videos • Select Photos and Videos • Programmatic feature detection • MediaPicker.PhotosSupported
  • 29. MediaPicker • Take Photos and Videos • Select Photos and Videos • Programmatic feature detection • MediaPicker.PhotosSupported • MediaPicker.VideosSupported
  • 31. Selecting Photos var picker = new MediaPicker (); picker.PickPhotoAsync () .ContinueWith (t => { if (t.IsCanceled || t.IsFaulted) // user cancelled or error return; Bitmap b = BitmapFactory.DecodeFile (t.Result.Path); RunOnUiThread (() => platformImage.SetImageBitmap (b)); });
  • 32. Selecting Photos var picker = new MediaPicker (); picker.PickPhotoAsync () .ContinueWith (t => { if (t.IsCanceled || t.IsFaulted) // user cancelled or error return; Bitmap b = BitmapFactory.DecodeFile (t.Result.Path); RunOnUiThread (() => platformImage.SetImageBitmap (b)); });
  • 34. Taking Photos or Videos • Specify which camera to use
  • 35. Taking Photos or Videos • Specify which camera to use • Query for camera availability
  • 36. Taking Photos or Videos • Specify which camera to use • Query for camera availability • Specify video quality
  • 37. Taking Photos or Videos • Specify which camera to use • Query for camera availability • Specify video quality • Async and C# TPL Compatible
  • 38. Taking Photos or Videos • Specify which camera to use • Query for camera availability • Specify video quality • Async and C# TPL Compatible • Task.ContinueWith, IsCancelled, IsFaulted
  • 39. Taking Photos or Videos if (!picker.IsCameraAvailable) return; VideoView videoView = FindViewById<VideoView> (Resource.Id.video); picker.TakeVideoAsync (new StoreVideoOptions { Directory = "Xamovies", DefaultCamera = CameraDevice.Front, DesiredLength = TimeSpan.FromMinutes (5) }) .ContinueWith (t => { if (t.IsCanceled || t.IsFaulted) // user cancelled or error return; videoView.SetVideoPath (t.Result.Path); });
  • 43. Geolocation • Geolocator class • Retrieve current location
  • 44. Geolocation • Geolocator class • Retrieve current location • Listen for Location changes
  • 45. Geolocation • Geolocator class • Retrieve current location • Listen for Location changes • DesiredAccuracy influences the location technology that is used
  • 47. Resources • http://xamarin.com/mobileapi • Download: http://xamarin.com/xamarinmobileapipreview.zip • API Docs: http://betaapi.xamarin.com/?link=root:/Xamarin.Mobile
  • 48. Xamarin Seminar Please give us your feedback http://bit.ly/xamfeedback Follow us on Twitter @XamarinHQ Copyright 2012 © Xamarin Inc. All rights reserved

Notas do Editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n