Presenta(on	
  On	
  
GPS,	
  Map-­‐kit,	
  Core-­‐Loca(on	
  and	
  
Region	
  Monitoring,	
  Geo-­‐fencing	
  	
  
Presented	
  By	
  
Syed	
  Mahboob	
  Nur	
  	
  
iOS	
  Developer	
  	
  
	
  
Blog:	
  
hEp://mahboobiosdeveloper.blogs...
GPS	
  
	
  
The	
  Global	
  Posi(oning	
  System	
  (GPS)	
  is	
  a	
  satellite-­‐based	
  naviga(on	
  system	
  
mad...
Map	
  View	
  
	
  
A	
  map	
  view	
  contains	
  a	
  flaEened	
  representa(on	
  	
  
of	
  a	
  spherical	
  object,...
Map	
  View	
  
Loca(on	
  Monitoring	
  	
  
Systems	
  
•  Core	
  Loca(on	
  	
  
•  Region	
  Monitoring	
  
•  Geo	
  Fencing	
  
•  ...
Core	
  Loca(on	
  
•  The	
  Core	
  Loca(on	
  framework	
  lets	
  you	
  determine	
  the	
  current	
  loca(on	
  or	...
Core	
  Loca(on	
  
Class	
  References	
  

Protocol	
  References	
  

Other	
  References	
  

CLBeacon	
  
CLBeaconReg...
Ini(alize	
  Loca(on	
  	
  
Manager	
  
-­‐	
  (void)startStandardUpdates	
  
{	
  	
  
	
   	
  if	
  (nil	
  ==	
  loca...
Ac9vate	
  GPS	
  Using	
  
	
  CoreLoca9on	
  Loca9on	
  Manager	
  
	
  
	
  	
  
If(!	
  loca(onManager)	
  
{ 	
  	
  ...
Core	
  Loca(on	
  
	
  Code	
  
	
  
-­‐  (void)loca9onManager:(CLLoca9onManager	
  *)manager	
  
didUpdateLoca9ons:(NSAr...
Problems	
  of	
  	
  
Ac(vate	
  GPS	
  all	
  the	
  (me	
  
•  Huge	
  BaEery	
  Consump(on	
  
	
  
	
  
Loca(on	
  	
  
Monitoring	
  System	
  that	
  	
  saves	
  BaEery	
  Life	
  

•  Region	
  Monitoring	
  
•  Geo	
  Fen...
Region	
  Monitoring	
  
	
  	
  
Region	
  monitoring	
  lets	
  you	
  monitor	
  boundary	
  
crossings	
  for	
  define...
Steps	
  of	
  implemen(ng	
  	
  
Region	
  Monitoring	
  
•  Declare	
  and	
  Ini(alize	
  a	
  MKCoordinateRegion	
  
...
Important	
  Codes	
  for	
  	
  
implemen(ng	
  	
  
Region	
  Monitoring	
  

•  MKCoordinateRegion	
  

–  A	
  structu...
Important	
  Codes	
  for	
  	
  
implemen(ng	
  	
  
Region	
  Monitoring	
  
CLCircularRegion	
  :	
  
	
  The	
  CLCirc...
Important	
  Codes	
  for	
  	
  
implemen(ng	
  	
  
Region	
  Monitoring	
  

•  Draw	
  a	
  circular	
  geofence:	
  
...
Important	
  Codes	
  for	
  	
  
implemen(ng	
  	
  
Region	
  Monitoring	
  

•  Delegate	
  method	
  to	
  make	
  Cir...
• 
	
  

Important	
  Codes	
  for	
  	
  
implemen(ng	
  	
  
Region	
  Monitoring	
  

Determine	
  when	
  user	
  ente...
Geofencing	
  	
  
•  A	
  geo-­‐fence	
  is	
  a	
  virtual	
  perimeter	
  for	
  a	
  real-­‐
world	
  geographic	
  ar...
Geofecing	
  
iBeacon	
  
•  iBeacon	
   is	
   an	
   indoor	
   posi(oning	
   system	
   that	
  
Apple	
   Inc	
   calls	
   "a	
   ...
I	
  Beacon	
  
 
That’s	
  all	
  for	
  Today	
  	
  
Upcoming SlideShare
Loading in …5
×

I os developers_meetup_4_sessionon_locationservices

266 views

Published on

A Presentation on Location Services and user tracking techniques. I create the presentation for the session of iOS Developers Meetup organized by LEADS .

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
266
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
4
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

I os developers_meetup_4_sessionon_locationservices

  1. 1. Presenta(on  On   GPS,  Map-­‐kit,  Core-­‐Loca(on  and   Region  Monitoring,  Geo-­‐fencing    
  2. 2. Presented  By   Syed  Mahboob  Nur     iOS  Developer       Blog:   hEp://mahboobiosdeveloper.blogspot.com/   Fb  Profile:   hEps://www.facebook.com/mahboob.nur      
  3. 3. GPS     The  Global  Posi(oning  System  (GPS)  is  a  satellite-­‐based  naviga(on  system   made  up  of  a  network  of  24  satellites  placed  into  orbit  by  the  U.S.    Department  of  Defense.  GPS  was  originally  intended  for  military  applica(ons,   but  in  the  1980s,  the  government  made  the  system  available  for  civilian  use.    GPS  works  in  any  weather  condi(ons,  anywhere  in  the  world,  24  hours  a  day.   There  are  no  subscrip(on  fees  or  setup  charges  to  use  GPS.  
  4. 4. Map  View     A  map  view  contains  a  flaEened  representa(on     of  a  spherical  object,  namely  the  Earth.    In  order  to  use  maps  effec(vely,  you  need  to    understand  a  liEle  bit  about  how  to  specify  points    in  a  map  view,  and  how  those  points  translate  to  points    on  the  Earth’s  surface.  Understanding  map  coordinate    systems  is  especially    important  if  you  plan  to  place  custom  content,  such  as  overlays   ,  on  top  of  the  map.    
  5. 5. Map  View  
  6. 6. Loca(on  Monitoring     Systems   •  Core  Loca(on     •  Region  Monitoring   •  Geo  Fencing   •  I  Beacon     And  so  on    
  7. 7. Core  Loca(on   •  The  Core  Loca(on  framework  lets  you  determine  the  current  loca(on  or   heading  associated  with  a  device.  The  framework  uses  the  available   hardware  to  determine  the  user’s  posi(on  and  heading.  You  use  the   classes  and  protocols  in  this  framework  to  configure  and  schedule  the   delivery  of  loca(on  and  heading  events.  You  can  also  use  it  to  define   geographic  regions  and  monitor  when  the  user  crosses  the  boundaries  of   those  regions.  In  iOS,  you  can  also  define  a  region  around  a  Bluetooth   beacon.  
  8. 8. Core  Loca(on   Class  References   Protocol  References   Other  References   CLBeacon   CLBeaconRegion    CLCircularRegion   CLGeocoder   CLHeading   CLLoca9on   CLLoca9onManager   CLPlacemark   CLRegion   CLLLoca9onManagerDeleg ate   Core  Loca9on  Func9ons   Core  Loca9on  Data  Types   Core  Loca9on  Constants        
  9. 9. Ini(alize  Loca(on     Manager   -­‐  (void)startStandardUpdates   {        if  (nil  ==  loca9onManager)      {                loca9onManager  =  [[CLLoca9onManager  alloc]  init];    loca9onManager.delegate  =  self;                loca9onManager.desiredAccuracy  =  kCLLoca9onAccuracyKilometer;    events.  loca9onManager.distanceFilter  =  500                [loca9onManager  startUpda9ngLoca9on];    }   }  
  10. 10. Ac9vate  GPS  Using    CoreLoca9on  Loca9on  Manager         If(!  loca(onManager)   {        [loca(onManager  setDelegate:self];      [loca(onManager  startUpda(ngLoca(on];      [loca(onManager      startMonitoringSignificantLoca(onChanges];          [loca(onManager  startUpda(ngHeading];   }        
  11. 11. Core  Loca(on    Code     -­‐  (void)loca9onManager:(CLLoca9onManager  *)manager   didUpdateLoca9ons:(NSArray  *)loca9ons    {                  NSLog(@"la9tude  %+.6f,  longitude  %+.6fn",              loca9on.coordinate.la9tude,  loca9on.coord  inate.longitude);              }    
  12. 12. Problems  of     Ac(vate  GPS  all  the  (me   •  Huge  BaEery  Consump(on      
  13. 13. Loca(on     Monitoring  System  that    saves  BaEery  Life   •  Region  Monitoring   •  Geo  Fencing      
  14. 14. Region  Monitoring       Region  monitoring  lets  you  monitor  boundary   crossings  for  defined  geographical  regions  and   Bluetooth  low  energy  beacon  regions.  (iOS  4.0   and  later.)  
  15. 15. Steps  of  implemen(ng     Region  Monitoring   •  Declare  and  Ini(alize  a  MKCoordinateRegion   •  Declare  and  Ini(alize  a  CLCircularRegion   •  Draw  a  circular  Geofence  around  the  current   loca(on  of  the  user.   •  Start  monitoring  region  un(l  user  exit  the   region     •  When  user  exit  the  region  draw  a  Circular   Geofence  and  start  monitoring  for  the  new   region.  
  16. 16. Important  Codes  for     implemen(ng     Region  Monitoring   •  MKCoordinateRegion   –  A  structure  that  defines  which  por(on  of  the  map  to  display.      MKCoordinateRegion  region;            region.center.la(tude  =            loca(onManager.loca(on.coordinate.la(tude;            region.center.longitude  =        loca(onManager.loca(on.coordinate.la(tude;                      region.span.la(tudeDelta  =  SPAN_VALUE;            region.span.longitudeDelta  =  SPAN_VALUE;            [self.mapView  setRegion:region  animated:YES];    
  17. 17. Important  Codes  for     implemen(ng     Region  Monitoring   CLCircularRegion  :    The  CLCircularRegion  class  defines  the  loca(on  and   boundaries  for  a  circular  geographic  region.  You  can  use   instances  of  this  class  to  define  geo  fences  for  a  specific   loca(on.  The  crossing  of  a  geo  fence’s  boundary  causes   the  loca(on  manager  to  no(fy  its  delegate     CLCircularRegion  *myRegion=[[CLCircularRegion   alloc]initWithCenter:region.center  radius:10   iden(fier:@"myRegion"];          [loca(onManager   startMonitoringForRegion:myRegion];    
  18. 18. Important  Codes  for     implemen(ng     Region  Monitoring   •  Draw  a  circular  geofence:          MKCircle  *circle  =  [MKCircle      circleWithCenterCoordinate:region.center      radius:100];    [self.mapView  addOverlay:circle];  
  19. 19. Important  Codes  for     implemen(ng     Region  Monitoring   •  Delegate  method  to  make  Circular  Overlay  Colorful          -­‐(MKOverlayView  *)  mapView:(MKMapView  *)mapView    viewForOverlay:(id<MKOverlay>)overlay    {            MKCircleView  *circleView  =  [[MKCircleView  alloc]      initWithCircle:overlay];            circleView.fillColor  =  [[UIColor  redColor]          colorWithAlphaComponent:0.1];            circleView.strokeColor  =  [[UIColor  blueColor]      colorWithAlphaComponent:1.0];            circleView.lineWidth  =  1;            return  circleView;    }      
  20. 20. •    Important  Codes  for     implemen(ng     Region  Monitoring   Determine  when  user  enters  and  exits  region    -­‐  (void)loca9onManager:(CLLoca9onManager  *)manager  didEnterRegion:(CLRegion  *)region    {              UIAlertView  *alert  =  [[UIAlertView  alloc]initWithTitle:@""   message:@"didEnterRegion"  delegate:nil  cancelBubonTitle:@"OK"  otherBubonTitles:nil,  nil];              [alert  show];              NSLog(@"didEnterRegion");    }    -­‐  (void)loca9onManager:(CLLoca9onManager  *)manager  didExitRegion:(CLRegion  *)region    {              UIAlertView  *alert  =  [[UIAlertView  alloc]initWithTitle:@""   message:@"didExitRegion"  delegate:nil  cancelBubonTitle:@"OK"  otherBubonTitles:nil,  nil];              [alert  show];      }  
  21. 21. Geofencing     •  A  geo-­‐fence  is  a  virtual  perimeter  for  a  real-­‐ world  geographic  areas.     •  A  geo-­‐fence  could  be  dynamically  generated— as  in  a  radius  around  a  store  or  point  loca(on.   Or  a  geo-­‐fence  can  be  a  predefined  set  of   boundaries,  like  school  aEendance  zones  or   neighborhood  boundaries.  Custom-­‐digi(zed   geofences  are  also  in  use.      
  22. 22. Geofecing  
  23. 23. iBeacon   •  iBeacon   is   an   indoor   posi(oning   system   that   Apple   Inc   calls   "a   new   class   of   low-­‐powered,   low-­‐cost   transmiEers   that   can   no(fy   nearby   iOS  7  devices  of  their  presence.     •  They   can   also   be   used   by   the   Android   opera(ng  system.[  The  technology  enables  an   iOS   device   or   other   hardware   to   send   push   no(fica(ons  to  iOS  devices  in  close  proximity.  
  24. 24. I  Beacon  
  25. 25.   That’s  all  for  Today    

×