android - Why use GoogleAPIClient to request location updates? -


i noticed it's possible request location updates in (at least) 2 different ways.

  1. using googleapiclient:

    // callback when googleapiclient connected @override public void onconnected(bundle connectionhint) {     locationservices.fusedlocationapi.requestlocationupdates(         mgoogleapiclient, mlocationrequest, this); } 

 

  1. using locationmanager:

    locationmanager locationmanager = (locationmanager) getactivity().     getsystemservice(context.location_service);        locationmanager.requestlocationupdates(locationmanager.gps_provider,      0, 0, locationlistener); 

 

google seems promote method 1 in tutorial "receiving location updates". it's unclear me benefit of method 1 is, because method 2 working fine me (i'm using both methods in 2 different places in app).

the new method location updates use fused location provider in android. best thing fused location provider api you not need worry location updates gives latest , accurate location , updates location after interval or on location change . 1 more thing fused location provider api you don't need think best location provider because automatically choose best 1 suited hardware of android device.

here youtube video in i/o 2013, may provide more details.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -