Chapter 9
Working with Maps and Locations
APPCELERATOR TITANIUM PROVIDES excellent support for most of your geolocation needs. This is not the complete demonstration of the functionality, but serves as more of an introduction. You should review the documentation provided on the website; the wiki has a separate section on using geolocation. Also review the Q&A forums, where you might find that someone has run into the same problem you are facing and the community has provided a solution.
See http://docs.appcelerator.com/titanium/latest/#!/guide/Location_Services for more information.
Associating GPS Information When Saving a Photo
Associating GPS information when you’re saving a photo involves the following steps, which are outlined in the following sections:
- Modifying the photo model
- Getting GPS information from a device
- Creating a CommonJS library for geolocation
- Updating the feed controller to add location to a photo
Modifying the Photo Model
No changes are required to the photo model to support saving geolocation information with the object. Appcelerator Cloud Services provides custom fields for storing this information. The way you have implemented the photo model allows for additional fields to be passed as parameters to the Save method of the photo model. That is the only change that’s required.
Getting GPS Information from a Device
To get geolocation information from the device, Appcelerator has provided a fair bit of functionality out of the box in its location services ...
Get Building Cross-Platform Apps using Titanium, Alloy, and Appcelerator Cloud Services 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.