App Inventor Classic • App Inventor Classic • FOR APP INVENTOR 2 CLICK HERE• App Inventor Classic • App Inventor Classic
The LocationSensor component can determine the phone's latitude and longitude as well as a street address. You can use it to share your location with others, record "breadcrumbs" on a journey or treasure hunt, or as a way to take roll in class (as long as the students have Android devices!)
The LocationSensor component can determine the phone's latitude and longitude as well as a street address. You can use it to share your location with others, record "breadcrumbs" on a journey or treasure hunt, or as a way to take roll in class (as long as the students have Android devices!)
The sample apps below are simple but illustrate the basic way that location can be determined. Both apps report the current latitude, longitude, and addres on the phone's display and, just for fun, speak the address aloud. The first app reports the location as soon as the sensor gets the data and every time the phone's location is changed. The second app only invokes the location sensor in response to an event-- when the user clicks a button.
For each sample app, the following is provided:
Report location data as soon as sensor reads it and when the location changes
TRY IT! Scan the QR code with your Android phone to install this app (if you haven't already, download a scanner from the Android Market)
CUSTOMIZE IT! Download the source blocks to your phone by clicking the button on the right, then upload into App Inventor by choosing More Actions | Upload Source on the Projects page.
UNDERSTAND IT! Here is the user interface and components for the app:
Here are the blocks for the app, with annotation:
This app illustrates how to access location information only when some event occurs. The LocationSensor is disabled to begin, then enabled when the button is clicked and disabled once again when the location is determined.
TRY IT! Scan the QR code with your Android phone to install this app (if you haven't already, download a scanner from the Android Market)
CUSTOMIZE IT! Download the source blocks to your phone by clicking the button on the right, then upload into App Inventor by choosing More Actions | Upload Source on the Projects page.
UNDERSTAND IT! Here is the user interface and components for the app:
Here are the blocks for the app, with annotation:
MIT and Google are grateful to Professor David Wolber, CS Professor at The University of San Francisco, for developing this tutorial.
The sample apps below are simple but illustrate the basic way that location can be determined. Both apps report the current latitude, longitude, and addres on the phone's display and, just for fun, speak the address aloud. The first app reports the location as soon as the sensor gets the data and every time the phone's location is changed. The second app only invokes the location sensor in response to an event-- when the user clicks a button.
For each sample app, the following is provided:
Report location data as soon as sensor reads it and when the location changes
TRY IT! Scan the QR code with your Android phone to install this app (if you haven't already, download a scanner from the Android Market)
CUSTOMIZE IT! Download the source blocks to your phone by clicking the button on the right, then upload into App Inventor by choosing More Actions | Upload Source on the Projects page.
UNDERSTAND IT! Here is the user interface and components for the app:
Here are the blocks for the app, with annotation:
This app illustrates how to access location information only when some event occurs. The LocationSensor is disabled to begin, then enabled when the button is clicked and disabled once again when the location is determined.
TRY IT! Scan the QR code with your Android phone to install this app (if you haven't already, download a scanner from the Android Market)
CUSTOMIZE IT! Download the source blocks to your phone by clicking the button on the right, then upload into App Inventor by choosing More Actions | Upload Source on the Projects page.
UNDERSTAND IT! Here is the user interface and components for the app:
Here are the blocks for the app, with annotation:
MIT and Google are grateful to Professor David Wolber, CS Professor at The University of San Francisco, for developing this tutorial.