SlideShare a Scribd company logo
1 of 52
   Core Location framework is used to determine
    the current latitude and longitude of a device
    and to configure and schedule the delivery of
    location-related events.

   Core Location uses a type of streaming
    notification so that your application receives
    updates as the GPS ascertains a more accurate
    fix.
There are three technologies that core
location uses :
   GPS
    Reads microwave signals from multiple
    satellites to determine the current
    location
   Cell Tower Triangulation
    Determine the current location by
    calculation based on location of cell
    towers in iPhone’s range.
   Wi-Fi positioning Service (WPS)
    Uses IP address from iPhone’s Wi-Fi
    connection by referencing database of
    service providers and areas they service
   This class defines the interface for configuring the
    delivery of location-related events to your
    application.
   To interact with core location we need to create an
    instance of Location Manager.
    CLLocationManager *locationManager=[[CLLocationManager alloc]init];

   Assign a delegate object to it, and configure the
    desired accuracy you want.
   Represents the location data generated by a
    CLLocationManager object.
   This object incorporates the geographical
    coordinates and altitude of the device’s location
    along with values indicating the accuracy of the
    measurements and when those measurements
    were made
Setting Desired Accuracy

The accuracy is set using CLLocationAccuracy
Value, a type that’s defined as double.

   kCLLocationAccuracyBest
   kCLLocationAccuracyNearestTenMeters
   kCLLocationAccuracyHundredMetres
   kCLLocationAccuracyKilometers
   kCLLocationAccuracyThreeKilometers

Setting Delegate and Accuracy:

    locationManager.delegate=self;
    locationManager.desiredAccuracy= kCLLocationAccuracyBest
Setting Distance Filter

   By specifying distance filter you can tell
    Location manager not to notify for every
    change in location but to only notify you
    when location changes by certain amount.

   Setting up a distance filter reduced the
    amount of polling that your application does.

   Specifying a distance filter of 1000 tells
    location manager not to notify the delegate
    until the iPhone has moved at least 1000
    meters from previously reported position
   For example:
    locationManager.distanceFilter=1000.0f;

   To return location manager to return to
    default setting with no filter then:

locationManager.distanceFilter=
                  kCLDistanceFilternone;
   When you are ready to start polling for location,
    you tell the location manager to start.

   It will continue to call your delegate method
    whenever it senses a change that exceeds the
    current distance filter

    [locationManager startUpdatingLocation];
   The location manager must confirms to
    CLLocationManagerDelegate protocol,     which
    defines two methods, both are optional.

   One method is called by location manager when it
    has determined current location or detects any
    change in location.

   Other method is called when location manager
    encounters an error.
   When the location manager wants to inform its
    delegate of the current location, it calls:
    locationManager:didUpdateToLocation:fromLocation

 First parameter is location Manager that called
  the delegate.
 Second is CLLocation object that defines current
  location of iPhone
 Third parameter is CLLocation object that defines
  previous location from last update (will be nil if
  method is called first time.)
 CLLocation object has some properties that might be
  interest to your application
 The latitude and longitude are stored in property called
  coordinate.

CLLocationDegrees latitude=theLocation.coordinate.latitude;
CLLocationDegrees longitude=theLocation.coordinate.longitude;

   CLLocation object also tell you how confident the location
    manager is in latitude and longitude calculations by the
    property horizontalAccuracy which describes the radius a
    circle with coordinates as its center.
   The CLLocation object also has a property called altitude
    that tell you how many metres above the sea level you
    are:
       CLLocationDistance altiude=theLocation.altitude

   Each CLLocation object maintains a property called
    verticalAccuracy that indicate how confident core location
    is in its altitude determination.

   If verticalAccuracy is negative core location is telling you
    that it cannot determine the altitude.
 The CLLocation object also have a timestamp that tells
  you when the location manager made he location
  determination.
 CLLocation object also have a useful instance method that
  will let you determine the distance between two
  CLLocation     objects.   The      method      is  called
  getDistanceFrom: and it works like this:

    CLLocationDistance distance=[fromLocation getDistanceFrom:toLocation];

   Calculation ignores the altitude as if both locations are at
    sea level
   If Core location is not able to determine your current
    location, it will call second delegate method named
    locationManager:didFailWithError:.
   Most likely cause of error is that user denies access as
    location manager needs to be authorized by the user.
   So, the first time your application goes to determine
    location an alert will popup on screen asking user if its OK
    for the current program to access your location. If user clicks
    the Don’t Allow button,your delegate will be notified with
    an error code kCLErrorDenied.
   Other error code is kCLErrorLocationUnnown which
    indicate core location unable to determine location but will
    keep trying.
Lets build a small
application to detect
the iPhone’s current
location and total
distance travelled while
program has been
running.
   In Xcode, create a new project using view-
    based application template and call the
    project WhereAmI..

   Expand the classes and resources folders and
    single-click WherAmIViewContoller..h and
    make following changes
   Open WhereAmIController.xib in IB. Drag
    12 labels from library to the view window.

   Labels on the right side after designing the
    application, should be connected to proper
    outlets

   Go back to Xcode.

   Open WhereAmIController.m
CLLocationManager Delegate Method
   The Address Book UI framework provides controllers that
    facilitate displaying, editing, selecting, and creating
    records in the Address Book database.

   On the iPhone, contact data resides in the home Library
    folder. On the Macintosh simulator, you can freely access
    these files in ~/Library/Application Support/iPhone
    Simulator/User/Library.
   The two files, AddressBook/AddressBook.sqlitedb and
    AddressBook/AddressBookImages.sqlitedb use standard
    SQLite3 to store contact information and optional
    contact images.

   On the iPhone, you cannot access these directly.
    The files live in /var/mobile/Library/AddressBook

   The Address Book UI framework provides two key user
    interfaces: a people "picker" navigation controller to
    choose contacts, and a view controller to display a single
    contact.
   There are four basic objects that you need to understand
    in order to interact fully with the Address Book database:
    address books, records, single-value properties, and
    multivalue properties
   Address books let you interact with the Address Book
    database and save changes to it. To use an address book,
    declare an instance of ABAddressBookRef and set it to the
    value returned from the function ABAddressBookCreate.

   After you have created an address book reference, your
    application can read data from it and save changes to it.
    To    save     the    changes,     use   the    function
    ABAddressBookSave; to abandon them, use the function
    ABAddressBookRevert. To check whether there are
    unsaved        changes,      use       the      function
    ABAddressBookHasUnsavedChanges.
   Person records are made up of both single-value and
    multi-value properties. Properties that a person can have
    only one of, such as first name and last name, are stored
    as single-value properties. Other properties that a person
    can have more that one of, such as street address and
    phone number, are multi-value properties.
 Users may organize their contacts into groups for a variety
  of reasons. For example, a user may create a group
  containing coworkers involved in a project, or members of
  a sports team they play on. Your application can use
  groups to allow the user to perform an action for several
  contacts in their address book at the same time.
 Group          records        have         only        one
  property, kABGroupNameProperty, which is the name of
  the group. To get all the people in a group, use the
  function
  ABGroupCopyArrayOfAllMembersWithSortOrdering or
  ABGroupCopyArrayOfAllMembers, which return a
   The Address Book UI framework provides one view
    controller and three navigation controllers for common
    tasks related to working with the Address Book database
    and contact information.

     ABPeoplePickerNavigationController prompts the user to select a
      person record from their address book.

     ABPersonViewController displays a person record to the user and
      optionally allows editing.
 ABNewPersonViewController prompts the user create a new
     person record.

     ABUnknownPersonViewController prompts the user to complete
     a partial person record, optionally allows them to add it to the
     address book.

   To use these controllers, you must set a delegate for them
    which implements the appropriate delegate protocol.
   Allows users to browse their
    list of contacts and select a
    person     and,    at    your
    option, one of that person’s
    properties.
   Displays a record to the user.




Person view controller—displaying with editing allowed
   Allows users to create a
    new person
   Allows the user to add
    data to an existing
    person record or to
    create a new person
    record for the data.
   In Xcode, create a new project from the View
    Based Application template. Save the project as
    QuickStart. The next step is to add the
    frameworks you will need. First, go to your
    project window and find the target named
    QuickStart in the Targets group. Open its info
    panel (File > Get Info) and, in the General
    tab, you see a list of linked libraries. Add the
    Address Book and Address Book UI frameworks
    by clicking the plus button and selecting them
    from the list.
@interface QuickStartViewController : UIViewController
 <ABPeoplePickerNavigationControllerDelegate>
 {
      IBOutlet UILabel *firstName;
      IBOutlet UILabel *lastName;
 }
  @property (nonatomic, retain) UILabel *firstName;
 @property (nonatomic, retain) UILabel *lastName;
 - (IBAction)showPicker:(id)sender;
@end
#import "QuickStartViewController.h“
@implementation QuickStartViewController
   @synthesize firstName;
  @synthesize lastName;
  -(IBAction)showPicker:(id)sender
  {
      ABPeoplePickerNavigationController *picker =
              [[ABPeoplePickerNavigationController alloc] init];
      picker.peoplePickerDelegate = self; [self
      presentModalViewController:picker animated:YES];
      [picker release];
  }
   you will now begin implementing the delegate
    protocol, by adding two more methods.

    If the user cancels, the first method is called to dismiss
    the people picker.

   If the user selects a person, the second method is called
    to copy the first and last name of the person into the
    labels and dismiss the people picker.
(void)peoplePickerNavigationControllerDidCancel:
  (ABPeoplePickerNavigationController*) peoplePicker
{
   [self dismissModalViewControllerAnimated:YES];
}
- (BOOL)peoplePickerNavigationController:
        (ABPeoplePickerNavigationController *)peoplePicker
    shouldContinueAfterSelectingPerson:(ABRecordRef)person
 {
     NSString* name = (NSString *)ABRecordCopyValue(person,
                             kABPersonFirstNameProperty);
    self.firstName.text = name;
     [name release];
     name = (NSString *)ABRecordCopyValue(person,
                             kABPersonLastNameProperty);
    self.lastName.text = name; [name release];
    [self dismissModalViewControllerAnimated:YES];
    return NO;
}
   To fully implement the delegate protocol, you
    must also add one more following function. The
    people picker calls this third function when the
    user taps on a property of the selected person
    in the picker. In this application, the people
    picker is dismissed when the user selects a
    person, so there is no way for the user to select
    a property of that person. This means that the
    third method can never be called. However if it
    were left out, the implementation of the
    protocol would be incomplete.
(BOOL)peoplePickerNavigationController:
  (ABPeoplePickerNavigationController *)peoplePicker
  shouldContinueAfterSelectingPerson: (ABRecordRef)person
  property:(ABPropertyID)property
  identifier:(ABMultiValueIdentifier)identifier
  {
      return NO;
  }
(void)dealloc
{
  [firstName release];
   [lastName release];
  [super dealloc];
}
@end
   In the Identity inspector (Tools > Identity
    Inspector), verify that the class identity of File’s
    Owner is QuickStartViewController—it should
    already be set correctly for you by the
    template. Connect the outlets for firstName
    and lastName from File’s Owner to the first
    name and last name labels. Finally, connect the
    Touch Up Inside outlet from the button to File’s
    Owner and select the showPicker method.
   Items that start on power up:
    The LaunchDaemons folders contain items that will run as root, generally
    background processes.

   The LaunchAgents folders contain jobs, called agent applications, that will run as
    a user or in the context of userland.

   If your job needs to run even when no users are logged in, put it in
    /Library/LaunchDaemons.
    - If it is only useful when users are logged in, put it in /Library/LaunchAgents,
    or in the personal LaunchAgents directories of specific users.

   Do not put your job in /System/Library, which is reserved for system-provided
    daemons.
Core Location and Address Book Frameworks

More Related Content

Viewers also liked

iPhone でバックグラウンド位置情報アプリケーションを作ってみた。
iPhone でバックグラウンド位置情報アプリケーションを作ってみた。iPhone でバックグラウンド位置情報アプリケーションを作ってみた。
iPhone でバックグラウンド位置情報アプリケーションを作ってみた。Hal Seki
 
iOS Development - A Beginner Guide
iOS Development - A Beginner GuideiOS Development - A Beginner Guide
iOS Development - A Beginner GuideAndri Yadi
 
Location based presentation 2 ppt
Location based presentation 2 pptLocation based presentation 2 ppt
Location based presentation 2 pptCraig Agranoff
 
Introduction to iOS Development
Introduction to iOS DevelopmentIntroduction to iOS Development
Introduction to iOS DevelopmentAsim Rais Siddiqui
 
7 Hot Location-Based Apps You Should Know About
7 Hot Location-Based Apps You Should Know About7 Hot Location-Based Apps You Should Know About
7 Hot Location-Based Apps You Should Know AboutShauna Causey
 
6 Key Trends from CES 2017
6 Key Trends from CES 20176 Key Trends from CES 2017
6 Key Trends from CES 2017Havas Media
 
Location Based Services: Global Market Overview, Deployment Trends and Potent...
Location Based Services: Global Market Overview, Deployment Trends and Potent...Location Based Services: Global Market Overview, Deployment Trends and Potent...
Location Based Services: Global Market Overview, Deployment Trends and Potent...Convergence Catalyst
 
Location-Based Services on Android
Location-Based Services on AndroidLocation-Based Services on Android
Location-Based Services on AndroidJomar Tigcal
 
Location-based Marketing (LBM) - Global Media Trends
Location-based Marketing (LBM) - Global Media Trends Location-based Marketing (LBM) - Global Media Trends
Location-based Marketing (LBM) - Global Media Trends Havas Media
 
Location Based Services: Business Model
Location Based Services: Business ModelLocation Based Services: Business Model
Location Based Services: Business ModelEvangelos Tselentis
 
Location based reminder
Location based reminderLocation based reminder
Location based reminderjunnubabu
 
Location Based Services - An Overview
Location Based Services - An Overview Location Based Services - An Overview
Location Based Services - An Overview amsanjeev
 
Location Based services
Location Based servicesLocation Based services
Location Based servicesFraj Alshahibi
 

Viewers also liked (14)

iPhone でバックグラウンド位置情報アプリケーションを作ってみた。
iPhone でバックグラウンド位置情報アプリケーションを作ってみた。iPhone でバックグラウンド位置情報アプリケーションを作ってみた。
iPhone でバックグラウンド位置情報アプリケーションを作ってみた。
 
iOS Development - A Beginner Guide
iOS Development - A Beginner GuideiOS Development - A Beginner Guide
iOS Development - A Beginner Guide
 
Location based presentation 2 ppt
Location based presentation 2 pptLocation based presentation 2 ppt
Location based presentation 2 ppt
 
Introduction to iOS Development
Introduction to iOS DevelopmentIntroduction to iOS Development
Introduction to iOS Development
 
7 Hot Location-Based Apps You Should Know About
7 Hot Location-Based Apps You Should Know About7 Hot Location-Based Apps You Should Know About
7 Hot Location-Based Apps You Should Know About
 
6 Key Trends from CES 2017
6 Key Trends from CES 20176 Key Trends from CES 2017
6 Key Trends from CES 2017
 
Location Based Services: Global Market Overview, Deployment Trends and Potent...
Location Based Services: Global Market Overview, Deployment Trends and Potent...Location Based Services: Global Market Overview, Deployment Trends and Potent...
Location Based Services: Global Market Overview, Deployment Trends and Potent...
 
Location-Based Services on Android
Location-Based Services on AndroidLocation-Based Services on Android
Location-Based Services on Android
 
Location-based Marketing (LBM) - Global Media Trends
Location-based Marketing (LBM) - Global Media Trends Location-based Marketing (LBM) - Global Media Trends
Location-based Marketing (LBM) - Global Media Trends
 
Location Based Services: Business Model
Location Based Services: Business ModelLocation Based Services: Business Model
Location Based Services: Business Model
 
Location based reminder
Location based reminderLocation based reminder
Location based reminder
 
Location Based Services - An Overview
Location Based Services - An Overview Location Based Services - An Overview
Location Based Services - An Overview
 
Location Based services
Location Based servicesLocation Based services
Location Based services
 
20 Hot Location-Based Apps and Services You Should Know About
20 Hot Location-Based Apps and Services You Should Know About20 Hot Location-Based Apps and Services You Should Know About
20 Hot Location-Based Apps and Services You Should Know About
 

Similar to Core Location and Address Book Frameworks

Mobile Application Development-Lecture 15 & 16.pdf
Mobile Application Development-Lecture 15 & 16.pdfMobile Application Development-Lecture 15 & 16.pdf
Mobile Application Development-Lecture 15 & 16.pdfAbdullahMunir32
 
Windows phone 7 series
Windows phone 7 seriesWindows phone 7 series
Windows phone 7 seriesopenbala
 
Android location and sensors API
Android location and sensors APIAndroid location and sensors API
Android location and sensors APIeleksdev
 
Develop a native application that uses GPS location.pptx
Develop a native application that uses GPS location.pptxDevelop a native application that uses GPS location.pptx
Develop a native application that uses GPS location.pptxvishal choudhary
 
Mobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdfMobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdfAbdullahMunir32
 
Repository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity FrameworkRepository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity FrameworkAkhil Mittal
 
Draft activity recognition from accelerometer data
Draft activity recognition from accelerometer dataDraft activity recognition from accelerometer data
Draft activity recognition from accelerometer dataRaghu Palakodety
 
Android building blocks and application life cycle-chapter3
Android building blocks and application life cycle-chapter3Android building blocks and application life cycle-chapter3
Android building blocks and application life cycle-chapter3Dr. Ramkumar Lakshminarayanan
 
Multi-Cloud Micro-Services with CloudFoundry
Multi-Cloud Micro-Services with CloudFoundryMulti-Cloud Micro-Services with CloudFoundry
Multi-Cloud Micro-Services with CloudFoundrygeekclub888
 
iOS Architectures
iOS ArchitecturesiOS Architectures
iOS ArchitecturesHung Hoang
 
Meteor Meet-up San Diego December 2014
Meteor Meet-up San Diego December 2014Meteor Meet-up San Diego December 2014
Meteor Meet-up San Diego December 2014Lou Sacco
 
Data Transfer between activities and Database
Data Transfer between activities and Database Data Transfer between activities and Database
Data Transfer between activities and Database faiz324545
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentIJERD Editor
 
Multi cloud appcustomscale-appgroups-slideshare
Multi cloud appcustomscale-appgroups-slideshareMulti cloud appcustomscale-appgroups-slideshare
Multi cloud appcustomscale-appgroups-slideshareE Ting
 
Smart Way to Track the Location in Android Operating System
Smart Way to Track the Location in Android Operating SystemSmart Way to Track the Location in Android Operating System
Smart Way to Track the Location in Android Operating SystemIOSR Journals
 
Android App Development 04 : Location API
Android App Development 04 : Location APIAndroid App Development 04 : Location API
Android App Development 04 : Location APIAnuchit Chalothorn
 

Similar to Core Location and Address Book Frameworks (20)

Mobile Application Development-Lecture 15 & 16.pdf
Mobile Application Development-Lecture 15 & 16.pdfMobile Application Development-Lecture 15 & 16.pdf
Mobile Application Development-Lecture 15 & 16.pdf
 
Windows phone 7 series
Windows phone 7 seriesWindows phone 7 series
Windows phone 7 series
 
Android location and sensors API
Android location and sensors APIAndroid location and sensors API
Android location and sensors API
 
MAD Unit 6.pptx
MAD Unit 6.pptxMAD Unit 6.pptx
MAD Unit 6.pptx
 
Develop a native application that uses GPS location.pptx
Develop a native application that uses GPS location.pptxDevelop a native application that uses GPS location.pptx
Develop a native application that uses GPS location.pptx
 
Mobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdfMobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdf
 
Chapter 6-Remoting
Chapter 6-RemotingChapter 6-Remoting
Chapter 6-Remoting
 
Repository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity FrameworkRepository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity Framework
 
Ch14
Ch14Ch14
Ch14
 
Draft activity recognition from accelerometer data
Draft activity recognition from accelerometer dataDraft activity recognition from accelerometer data
Draft activity recognition from accelerometer data
 
Android building blocks and application life cycle-chapter3
Android building blocks and application life cycle-chapter3Android building blocks and application life cycle-chapter3
Android building blocks and application life cycle-chapter3
 
Multi-Cloud Micro-Services with CloudFoundry
Multi-Cloud Micro-Services with CloudFoundryMulti-Cloud Micro-Services with CloudFoundry
Multi-Cloud Micro-Services with CloudFoundry
 
Location based services
Location based servicesLocation based services
Location based services
 
iOS Architectures
iOS ArchitecturesiOS Architectures
iOS Architectures
 
Meteor Meet-up San Diego December 2014
Meteor Meet-up San Diego December 2014Meteor Meet-up San Diego December 2014
Meteor Meet-up San Diego December 2014
 
Data Transfer between activities and Database
Data Transfer between activities and Database Data Transfer between activities and Database
Data Transfer between activities and Database
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and Development
 
Multi cloud appcustomscale-appgroups-slideshare
Multi cloud appcustomscale-appgroups-slideshareMulti cloud appcustomscale-appgroups-slideshare
Multi cloud appcustomscale-appgroups-slideshare
 
Smart Way to Track the Location in Android Operating System
Smart Way to Track the Location in Android Operating SystemSmart Way to Track the Location in Android Operating System
Smart Way to Track the Location in Android Operating System
 
Android App Development 04 : Location API
Android App Development 04 : Location APIAndroid App Development 04 : Location API
Android App Development 04 : Location API
 

Recently uploaded

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 

Recently uploaded (20)

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 

Core Location and Address Book Frameworks

  • 1.
  • 2. Core Location framework is used to determine the current latitude and longitude of a device and to configure and schedule the delivery of location-related events.  Core Location uses a type of streaming notification so that your application receives updates as the GPS ascertains a more accurate fix.
  • 3. There are three technologies that core location uses :  GPS Reads microwave signals from multiple satellites to determine the current location  Cell Tower Triangulation Determine the current location by calculation based on location of cell towers in iPhone’s range.  Wi-Fi positioning Service (WPS) Uses IP address from iPhone’s Wi-Fi connection by referencing database of service providers and areas they service
  • 4. This class defines the interface for configuring the delivery of location-related events to your application.  To interact with core location we need to create an instance of Location Manager. CLLocationManager *locationManager=[[CLLocationManager alloc]init];  Assign a delegate object to it, and configure the desired accuracy you want.
  • 5. Represents the location data generated by a CLLocationManager object.  This object incorporates the geographical coordinates and altitude of the device’s location along with values indicating the accuracy of the measurements and when those measurements were made
  • 6. Setting Desired Accuracy The accuracy is set using CLLocationAccuracy Value, a type that’s defined as double.  kCLLocationAccuracyBest  kCLLocationAccuracyNearestTenMeters  kCLLocationAccuracyHundredMetres  kCLLocationAccuracyKilometers  kCLLocationAccuracyThreeKilometers Setting Delegate and Accuracy: locationManager.delegate=self; locationManager.desiredAccuracy= kCLLocationAccuracyBest
  • 7. Setting Distance Filter  By specifying distance filter you can tell Location manager not to notify for every change in location but to only notify you when location changes by certain amount.  Setting up a distance filter reduced the amount of polling that your application does.  Specifying a distance filter of 1000 tells location manager not to notify the delegate until the iPhone has moved at least 1000 meters from previously reported position
  • 8. For example: locationManager.distanceFilter=1000.0f;  To return location manager to return to default setting with no filter then: locationManager.distanceFilter= kCLDistanceFilternone;
  • 9. When you are ready to start polling for location, you tell the location manager to start.  It will continue to call your delegate method whenever it senses a change that exceeds the current distance filter [locationManager startUpdatingLocation];
  • 10. The location manager must confirms to CLLocationManagerDelegate protocol, which defines two methods, both are optional.  One method is called by location manager when it has determined current location or detects any change in location.  Other method is called when location manager encounters an error.
  • 11. When the location manager wants to inform its delegate of the current location, it calls: locationManager:didUpdateToLocation:fromLocation  First parameter is location Manager that called the delegate.  Second is CLLocation object that defines current location of iPhone  Third parameter is CLLocation object that defines previous location from last update (will be nil if method is called first time.)
  • 12.  CLLocation object has some properties that might be interest to your application  The latitude and longitude are stored in property called coordinate. CLLocationDegrees latitude=theLocation.coordinate.latitude; CLLocationDegrees longitude=theLocation.coordinate.longitude;  CLLocation object also tell you how confident the location manager is in latitude and longitude calculations by the property horizontalAccuracy which describes the radius a circle with coordinates as its center.
  • 13. The CLLocation object also has a property called altitude that tell you how many metres above the sea level you are: CLLocationDistance altiude=theLocation.altitude  Each CLLocation object maintains a property called verticalAccuracy that indicate how confident core location is in its altitude determination.  If verticalAccuracy is negative core location is telling you that it cannot determine the altitude.
  • 14.  The CLLocation object also have a timestamp that tells you when the location manager made he location determination.  CLLocation object also have a useful instance method that will let you determine the distance between two CLLocation objects. The method is called getDistanceFrom: and it works like this: CLLocationDistance distance=[fromLocation getDistanceFrom:toLocation];  Calculation ignores the altitude as if both locations are at sea level
  • 15. If Core location is not able to determine your current location, it will call second delegate method named locationManager:didFailWithError:.  Most likely cause of error is that user denies access as location manager needs to be authorized by the user.  So, the first time your application goes to determine location an alert will popup on screen asking user if its OK for the current program to access your location. If user clicks the Don’t Allow button,your delegate will be notified with an error code kCLErrorDenied.  Other error code is kCLErrorLocationUnnown which indicate core location unable to determine location but will keep trying.
  • 16.
  • 17. Lets build a small application to detect the iPhone’s current location and total distance travelled while program has been running.
  • 18. In Xcode, create a new project using view- based application template and call the project WhereAmI..  Expand the classes and resources folders and single-click WherAmIViewContoller..h and make following changes
  • 19.
  • 20. Open WhereAmIController.xib in IB. Drag 12 labels from library to the view window.  Labels on the right side after designing the application, should be connected to proper outlets  Go back to Xcode.  Open WhereAmIController.m
  • 21.
  • 22.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28. The Address Book UI framework provides controllers that facilitate displaying, editing, selecting, and creating records in the Address Book database.  On the iPhone, contact data resides in the home Library folder. On the Macintosh simulator, you can freely access these files in ~/Library/Application Support/iPhone Simulator/User/Library.
  • 29. The two files, AddressBook/AddressBook.sqlitedb and AddressBook/AddressBookImages.sqlitedb use standard SQLite3 to store contact information and optional contact images.  On the iPhone, you cannot access these directly. The files live in /var/mobile/Library/AddressBook  The Address Book UI framework provides two key user interfaces: a people "picker" navigation controller to choose contacts, and a view controller to display a single contact.
  • 30. There are four basic objects that you need to understand in order to interact fully with the Address Book database: address books, records, single-value properties, and multivalue properties
  • 31. Address books let you interact with the Address Book database and save changes to it. To use an address book, declare an instance of ABAddressBookRef and set it to the value returned from the function ABAddressBookCreate.  After you have created an address book reference, your application can read data from it and save changes to it. To save the changes, use the function ABAddressBookSave; to abandon them, use the function ABAddressBookRevert. To check whether there are unsaved changes, use the function ABAddressBookHasUnsavedChanges.
  • 32. Person records are made up of both single-value and multi-value properties. Properties that a person can have only one of, such as first name and last name, are stored as single-value properties. Other properties that a person can have more that one of, such as street address and phone number, are multi-value properties.
  • 33.  Users may organize their contacts into groups for a variety of reasons. For example, a user may create a group containing coworkers involved in a project, or members of a sports team they play on. Your application can use groups to allow the user to perform an action for several contacts in their address book at the same time.  Group records have only one property, kABGroupNameProperty, which is the name of the group. To get all the people in a group, use the function ABGroupCopyArrayOfAllMembersWithSortOrdering or ABGroupCopyArrayOfAllMembers, which return a
  • 34. The Address Book UI framework provides one view controller and three navigation controllers for common tasks related to working with the Address Book database and contact information.  ABPeoplePickerNavigationController prompts the user to select a person record from their address book.  ABPersonViewController displays a person record to the user and optionally allows editing.
  • 35.  ABNewPersonViewController prompts the user create a new person record.  ABUnknownPersonViewController prompts the user to complete a partial person record, optionally allows them to add it to the address book.  To use these controllers, you must set a delegate for them which implements the appropriate delegate protocol.
  • 36. Allows users to browse their list of contacts and select a person and, at your option, one of that person’s properties.
  • 37. Displays a record to the user. Person view controller—displaying with editing allowed
  • 38. Allows users to create a new person
  • 39. Allows the user to add data to an existing person record or to create a new person record for the data.
  • 40. In Xcode, create a new project from the View Based Application template. Save the project as QuickStart. The next step is to add the frameworks you will need. First, go to your project window and find the target named QuickStart in the Targets group. Open its info panel (File > Get Info) and, in the General tab, you see a list of linked libraries. Add the Address Book and Address Book UI frameworks by clicking the plus button and selecting them from the list.
  • 41.
  • 42. @interface QuickStartViewController : UIViewController <ABPeoplePickerNavigationControllerDelegate> { IBOutlet UILabel *firstName; IBOutlet UILabel *lastName; } @property (nonatomic, retain) UILabel *firstName; @property (nonatomic, retain) UILabel *lastName; - (IBAction)showPicker:(id)sender; @end
  • 43. #import "QuickStartViewController.h“ @implementation QuickStartViewController @synthesize firstName; @synthesize lastName; -(IBAction)showPicker:(id)sender { ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init]; picker.peoplePickerDelegate = self; [self presentModalViewController:picker animated:YES]; [picker release]; }
  • 44. you will now begin implementing the delegate protocol, by adding two more methods.  If the user cancels, the first method is called to dismiss the people picker.  If the user selects a person, the second method is called to copy the first and last name of the person into the labels and dismiss the people picker.
  • 45. (void)peoplePickerNavigationControllerDidCancel: (ABPeoplePickerNavigationController*) peoplePicker { [self dismissModalViewControllerAnimated:YES]; }
  • 46. - (BOOL)peoplePickerNavigationController: (ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person { NSString* name = (NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty); self.firstName.text = name; [name release]; name = (NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty); self.lastName.text = name; [name release]; [self dismissModalViewControllerAnimated:YES]; return NO; }
  • 47. To fully implement the delegate protocol, you must also add one more following function. The people picker calls this third function when the user taps on a property of the selected person in the picker. In this application, the people picker is dismissed when the user selects a person, so there is no way for the user to select a property of that person. This means that the third method can never be called. However if it were left out, the implementation of the protocol would be incomplete.
  • 48. (BOOL)peoplePickerNavigationController: (ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson: (ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier { return NO; } (void)dealloc { [firstName release]; [lastName release]; [super dealloc]; } @end
  • 49. In the Identity inspector (Tools > Identity Inspector), verify that the class identity of File’s Owner is QuickStartViewController—it should already be set correctly for you by the template. Connect the outlets for firstName and lastName from File’s Owner to the first name and last name labels. Finally, connect the Touch Up Inside outlet from the button to File’s Owner and select the showPicker method.
  • 50.
  • 51. Items that start on power up: The LaunchDaemons folders contain items that will run as root, generally background processes.  The LaunchAgents folders contain jobs, called agent applications, that will run as a user or in the context of userland.  If your job needs to run even when no users are logged in, put it in /Library/LaunchDaemons. - If it is only useful when users are logged in, put it in /Library/LaunchAgents, or in the personal LaunchAgents directories of specific users.  Do not put your job in /System/Library, which is reserved for system-provided daemons.

Editor's Notes

  1. ABPeoplePickerNavigationController
  2. ABPeoplePickerNavigationController
  3. ABPeoplePickerNavigationController
  4. ABPeoplePickerNavigationController
  5. ABPeoplePickerNavigationController
  6. ABPeoplePickerNavigationController
  7. ABPeoplePickerNavigationController
  8. ABPeoplePickerNavigationController
  9. ABPeoplePickerNavigationController
  10. ABPeoplePickerNavigationController
  11. ABPeoplePickerNavigationController
  12. ABPeoplePickerNavigationController
  13. ABPeoplePickerNavigationController
  14. ABPeoplePickerNavigationController