Saving Location Data

A location is just a small set of numbers, so we can save it like any other number. For example, we can store latitude and longitude in a pair of global variables. We can add them to a list. We can store them to the phone’s local persistent storage with TinyDB. We can put them online with TinyWebDB. We can email them or text them, or do anything else with them, because they’re just numbers.

Keep in mind that global variables, including lists stored in them, keep data only as long as the app is running. When you go back to the home screen or switch to a different application, the operating system might close your app and then data in variables would disappear. To save your data so that it reliably comes back, you have to put ...

Get Learning MIT App Inventor: A Hands-On Guide to Building Your Own Android Apps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.