io13 deep dive location api

25
IO13 Deep Dive - Location API Technical deep dive What’s new in Location API Amrit Sanjeev Bangalore Android User Group

Upload: amsanjeev

Post on 24-Jun-2015

335 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Io13 deep dive   location api

IO13 Deep Dive - Location API

Technical deep dive �

What’s new in Location API

Amrit Sanjeev Bangalore Android User Group

Page 2: Io13 deep dive   location api

What’s on the agenda today ?

Let go and find where our users are

1Before the new API

2New APIs

3How is it implmented

Page 3: Io13 deep dive   location api

Before the new API

Things to keep in mind before you create your world using LBS

1

Page 4: Io13 deep dive   location api

Some interesting stats

• people  where  aware  of  LBS  63%  

• report  having  used  LBS  52%  

• thought  it  was  valuable  94%  

• expressed  concerns    52%  

•  32% use it every month

•  10% use it every day

•  18% tell others their location

 

•  Expose location without consent 84%

•  Identity theft 84%

•  Loss of privacy 84%

 

Page 5: Io13 deep dive   location api

LBS : Aspects to work on

LBS

Control

(Legal)

Trust

(Social)

Privacy

(Ethical)

Security (Technolog

ical)

Page 6: Io13 deep dive   location api

Complexity: What devs needed to work with

Page 7: Io13 deep dive   location api

Trend : Changes in the type of application

Task     Contextual  

Page 8: Io13 deep dive   location api

Complexity : Sensor usage

Page 9: Io13 deep dive   location api

2 Introduction to new APIs

Shiny new toys

Page 10: Io13 deep dive   location api

Obstacles in LBS adoption

Fused Location provider

Geofencing

Acitvity monitoring

Page 11: Io13 deep dive   location api

API : Fused Location Provider

Power

Accuracy

Coverage

Page 12: Io13 deep dive   location api

API : Fused Location Provider

Before   AEer  

•  Simplified API •  3 main aspects than was worked on

•  Speed •  Accuracy •  Coverge

Page 13: Io13 deep dive   location api

Major Changes

Abstracts the use and switching between different hardware

based on availability .

Simpler API and workflow

Better battery performance

Better average accuracy

Support for both listeners and pending

intents

Page 14: Io13 deep dive   location api

Workflow – with listeners

•  Create a instance of location client locationClient = new LocationClient();!!

•  Call connect on it locationClient.connect();!!

•  Get the last location if required by your logic Location loc = locationClient.getLastLocation();!!

•  Create a location request LocationRequest request = new LocationRequest();!request.setInterval(5000);!request.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);!

•  Request of location updates passing the request and listener locationClient.requestLocationUpdates(request, listener);!

Page 15: Io13 deep dive   location api

Workflow – with pending intent

•  Create a pending intent PendingIntent pIntent = PendingIntent.getService(…);!

•  Request of location updates passing the request and listener locationClient.requestLocationUpdates(request, listener);!

!

•  Write code to handle the intent Public void onHandleIntent(Intent intent);!

!

Page 16: Io13 deep dive   location api

Priority Modes

Page 17: Io13 deep dive   location api

GeoFencing – What and why

Virtual fence around a area that can be defined to get updates of users entering and exiting

Register 100 geofences in one app

Simple api for adding and removing geofences

Adjusts location updates based on user’s proximity to the geofence and user’s

activity (still, walking, driving, and so on).

Roughly 2/3 power saving compared to proximity

alert

Page 18: Io13 deep dive   location api

Workflow

•  Create a instance of location client locationClient = new LocationClient();!

•  In onConnected() callback , create a geofence object Geofence.Builder gBuilder = new Geofence.Builder();!gBuilder.setTransitionType(…);!gBuilder.setCircularRegion(lat, long , radius);!gBuilder.setExpirationDuration(duration);!GeoFence gFence =gBuilder.build();!!

•  Add geofences to the locationclient locationClient.addGeoFences(List<GeoFences> , Pending Intent ,… );!

Page 19: Io13 deep dive   location api

Advantages

•  Reduces power usage •  System calls the pending intent to wake your

application . •  Entry or exit areas

Page 20: Io13 deep dive   location api

Activity Recognition

•  Sensor data to find the type of action the user is performing

Page 21: Io13 deep dive   location api

Workflow

•  Create an activity recognition client ActivityRecognitionClient aClient = new ActivityRecognitionClient(…);!

•  Connect the client aClient.connect();!!

•  Request for activity updates aClient.requestActivityUpdates(interval , callbackIntent)!!

•  Use onHandleIntent to get the calllback and extract the activity type . ActivityRecognitionResult result = ActivityRecognitionResult.extractResult(intent);!DetectedActivity act = result.getMostProbableActivity();!!!

Page 22: Io13 deep dive   location api

3 How is it implemeted ?

The internals

Page 23: Io13 deep dive   location api

Distribution channel

Google play services channel

Backward Compactible to

Froyo

Enhance APIs for indoor mapping

Auto update and faster release cycles

for new features

Improve accuracy using new tech like BT4.0 and 802.11v

Page 24: Io13 deep dive   location api

Q&A

Page 25: Io13 deep dive   location api