230 likes | 410 Views
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
E N D
Context Aware Location Nasrullah
Location Basics • LocationManager—Class providing access to Android system location services • LocationListener—Interface for receiving notifications from the LocationManagerwhen 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,movementand can also alert when the device enters or leaves a defined area. An example of initialization is LocationManagermLocationManager; 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 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);
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
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
Have you used some sort of database migration feature ,such as Rails ?
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