Download presentation
Presentation is loading. Please wait.
Published byEustace Williams Modified over 8 years ago
1
Context Aware Location Nasrullah
2
Location Basics LocationManager—Class providing access to Android system location services LocationListener—Interface for receiving notifications from the LocationManager when the location has changed Location—Class representing a geographic location determined at a particular time
3
LocationManager (step 1) 1)LocationManager needs – to be initialized with Android System Location Service This provides the application with the device’s current location,movement and can also alert when the device enters or leaves a defined area. An example of initialization is LocationManager mLocationManager; mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
4
Location Manager(step 2) Location Provider needs to be Selected – Wifi – Gps Before that select the criteria for the provider To find a proper location provider is to define the accuracy and power requirement. This enables the Android system to find the best available location technology for the specified requirements
5
Example step 2 Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setPowerRequirement(Criteria.POWER_LOW); Step 2(Assign the Provider to the LocationManager Class; String locationprovider = mLocationManager.getBestProvider(criteria, true);
6
LocationProviders It is also possible to specify the location estimation technology using the location manager’s getProvider() method. The two most common providers are the satellitebased Global Positioning System (GPS) (specified by LocationManager.GPS_PROVIDER) and cell-tower identification (specified by LocationManager.NETWORK_PROVIDER. The former is more accurate, but the latter is useful when a direct view of the sky is not available such as indoors
7
Adding Location Awareness Save chosen location on tasks Adding an overlay that shows the device current location Using DDMS to mock locations Displaying the current location co-ordinates and accuracy Filtering the Tasks by Location and Proximity
8
Location Based Services Brightkite Foursquare Gowolla Latitude
9
User-stories Save Address on Task See Current Location Show only nearby Tasks
10
Cast of Characters MyLocationOverlay – A simple mapoverlay that show’s the device current location LocationManager – A system utility class that can report the device’s current location DDMS – Dalvik Debug and Monitoring Server.A suite of tools to debug and control an Android System
11
Step-one – Saving an Address on Task
12
How a SQLiteOpenHelper works
13
Saving an Address on a Task Steps
14
Have you used some sort of database migration feature,such as Rails ?
15
Step 2 –Displaying an Address on its Task
16
Displaying as Address Steps
17
Step-3 Adding Current Location to the Map
18
Mocking Location
19
Providing Mock Location Data As you develop your application, you'll certainly need to test how well your model for obtaining user location works. This is most easily done using a real Android- powered device. If, however, you don't have a device, you can still test your location-based features by mocking location data in the Android emulator. There are three different ways to send your application mock location data: using Eclipse, DDMS, or the "geo" command in the emulator console (copied from) http://developer.android.com/guide/topics/location/st rategies.html http://developer.android.com/guide/topics/location/st rategies.html
20
Adding a Location to the map Steps
21
Step 4-Displaying a Current Location
22
Displaying Current Location Steps
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.