Book Image

LiveCode Mobile Development Beginner's Guide (2nd Edition)

Book Image

LiveCode Mobile Development Beginner's Guide (2nd Edition)

Overview of this book

Table of Contents (15 chapters)
LiveCode Mobile Development Beginner's Guide Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – trying out native location tracking


Later in this chapter, we will add in a feature to allow the app user to add a set of favorite locations. For the moment, we'll just try out the basic functions. Location doesn't work in the simulators; you'll have to try this on a real device:

  1. Use the test-rig stack from the preceding steps and add a Get Location button and a location field. Make sure that the location field is as wide as the card window; it will show three long numbers.

  2. Set the script of the button to the following:

    on mouseUp
      mobileStartTrackingSensor "location", true
      put mobileSensorReading("location", false) into field "location"
      mobileStopTrackingSensor "location"
    end mouseUp
  3. The true value in the second line is the one that defines a loosely value saying that we don't need the precision of GPS. The false value in the third line says that we don't need detailed information to be returned.

  4. Go to Standalone Application Settings and choose your target device as iOS...