Location Aware Apps and Maps

An app can determine the device's location using GPS. How can this information and/or such information from multiple devices be used to to build software that helps people? What are the potential pitfalls of such technology? In your next creative project you'll design a location-aware app. Let's first learn some of the technology and how you use it with App Inventor.

GPS and Google Maps
1. What does GPS stand for, who developed it and where does the data come from?

2. What is latitude? What is longitude?

3. Go to maps.google.com and click on My Places then the link to maps labs (near bottom of left panel) In Maps Labs, find the lat/long Tooltip and enable it. After you do that, you can  hold the shift key down on a map and it will show lat/long on map. Use the map to answer the following questions:

What is the GPS location of: 1) your birthplace? 2) Harney Science Center? 3) Greenwich in the UK? 4) Quito, Ecuador?

4. Enter the following URLs into a browser and figure out what they display:
http://maps.google.com/maps?saddr=38.59,-121.47&daddr=37.7,-122.47
https://maps.google.com/maps?q=37.77679,-122.4511

5. Determine a Maps URL, like the first one above, that shows a map from your hometown to your dorm/apt. in SF.

App Inventor Component: LocationSensor

Event: LocationChanged

Key Properties:
    Latitude, Longitude, Altitude, CurrentAddress, DistanceInterval, TimeInterval
Functions: HasLongitudeLatitude?


App Inventor Component: WebViewer
Put a browser in your app! Key Function: GoToURL

Building URLs
Use maketext block to add dynamic part (e.g., location) to static part (e.g., http://maps.google.com/maps?q=
Demo: show one's current location in a Google Map. Use makeText to build URL.

Sample App: Show location information and distance from some point:
l
Note: "Distance" is a procedure that's part of app. The blocks are on the next page



Your Turn
1. Install the apk for this app on your phone. See the barcode above (the apk is attached at the bottom of this page as well):

2. Walk outside and see what the app does. Walk and see how the settings change. Play around with the options to get a feel for TimeInterval and DistanceInterval.

3. Customize: Download the zip file attached to this page, then upload it into app inventor (on My Projects page, choose More Actions | Upload Source). Make the following changes to the app:
  • Personalize it so the app shows you the distance from some place of interest to you (your dorm room, USF campus, etc.). You'll need to change the parameters sent to the distance procedure, and be sure to also specify in the UI what place it is.
  • Talk It: instead of just vibrating and changing the display on updates, have the app also speak your current location aloud. You'll need to add a TextToSpeech component and its speak function block, and you'll need to use makeText ( the text drawer) to build the text that is spoken.
  • Add a WebViewer component that shows your current location in a Google map at all times.
  • Add a feature so that if you receive a text "where" from someone, the app will automatically send that person your location information. You'll need a Texting component and its "when Texting.MessageReceived" block. In your auto-response text, send the location and a link to a Google maps URL.
  • The distance from X label shows the distance in miles. Change this so that it shows the distance in meters.


Distance Procedure

This procedure was built using a known formula for approximating the distance, in miles, between two GPS coordinates




ċ
tracker.apk
(1264k)
David Wolber,
Mar 18, 2013, 9:06 PM
ċ
David Wolber,
Mar 18, 2013, 9:07 PM
Comments