context aware location
DESCRIPTION
Context Aware Location. Nasrullah. Location Basics. LocationManager —Class providing access to Android system location services LocationListener —Interface for receiving notifications from the LocationManager when the location has changed - PowerPoint PPT PresentationTRANSCRIPT
Context Aware Location
Nasrullah
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
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);
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
Example step 2Criteria 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);
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 satellitebasedGlobal 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
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
Location Based Services
• Brightkite• Foursquare• Gowolla• Latitude
User-stories
• Save Address on Task• See Current Location• Show only nearby Tasks
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
Step-one – Saving an Address on Task
How a SQLiteOpenHelper works
Saving an Address on a Task Steps
Have you used some sort of database migration feature ,such
as Rails ?
Step 2 –Displaying an Address on its Task
Displaying as Address Steps
Step-3 Adding Current Location to the Map
Mocking Location
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/strategies.html
Adding a Location to the map Steps
Step 4-Displaying a Current Location
Displaying Current Location Steps