The RememberButton is also enabled in this event-handler. The event-handler just places the readings-latitude, longitude, and current (street) address- into the corresponding "Current" labels so that they appear on the phone. LocationSensor1.LocationChanged: This event occurs when the phone's location sensor first gets a reading, or when the phone is moved to produce a new reading. Let's examine the four different event-handlers of the app, starting in the top-left and working around in counter-clockwise order. Here are the blocks for the Android, Where's My Car app (the yellow annotations will also appear when you load this app into App Inventor): Here is how they should be specified: Property Its properties are only partially shown above. The ActivityStarter1 component is used to launch the map when the user asks for directions. For these labels, a default value is set (0) here in the Component Designer. Others, such as CurrentLatLabel, will display dynamic data one the location sensor gets its readings. Some labels just show static text, e.g., GPSLabel is the text "GPS:" that appears in the user interface. The user interface consists of labels to show location data and buttons to initiate events. Here are the components for the Android, Where's My Car? app, as shown in the Component Designer: It makes use of the following App Inventor components: The app demonstrates how to communicate with the Android location sensor, how to record data in the phone's long-term memory (database), and how you can open the Google Maps app from your app to show directions from one one location to another. Photo licensed under Creative Commons Getting Started Later, when you reopen the app, it shows you a map from where you are to the remembered location- problem solved! With this app, you click a button when you park your car, and the Android uses its location sensor to record the car's GPS coordinates and address. The friends you came with are equally as clueless.įortunately you haven't lost your Android phone that never forgets anything, and you remember you have the hot new app, Android, Where's My Car?. You parked somewhere near the stadium, but when the concert ends you don't have a clue where the car is.
0 Comments
Leave a Reply. |