[MUSIC]
As we talk about using location and in particular,
as we talk about geo-regions, geo-fences and regions.
A little bit about iBeacons, we're going to need to talk a little bit more
specifically about simulating location.
In previous lectures in this specialization,
what we've seen is examples of using the map view.
And using some of the built in location simulation that's present
in the simulator.
There's actually some ability to do some more fined grained simulation of location.
And we're going to do that, so
we have a good way of testing our regions, when we go about implementing them.
So this lecture is about building a simulated location track and
then, what we're going to do.
Is in our case study, we're going to leverage it and
show you how to put it into the simulator at that point.
So the high level idea, is that as an app developer,
you need to carefully simulate movements to test things.
Like geofences and the question is how do you do that?
Well, what you do is you build a waypoint file and
the format of the waypoint file is something called a GPX file.
It's sort of a file that's leftover from
GPS logging devices that predated cellphones.
It is in XML format, if you're familiar with XML, means it's got a lot of tags.
It looks vaguely like HTML,
except that instead of having tags like body and had and anchor and image.
You have other tags that describe a progression
of movement through time and space.
So we're going to build one of those.
What we wan tto do is, we want to put several geographic points into that file.
Those geographic points are called waypoints and
basically, they're turning points.
You go straight until you hit a weigh point and
then you're assumed to go straight until you hit the next weight point.
And the times at which you hit each weigh point are specified through time stamps.
And it's assumed that you're moving evenly and
regularly between each weigh point in a straight line.
Together those waypoint describe a path.
And that path becomes the simulated
route that the device takes as your running your application.
It's treated as a circle, so when you get to the end
the device has assumed to go back to the beginning and restart it.
According to the plan that you've indicated, so
that can be used to simulate going through different regions.
But what it could be really used for
is testing to make sure that your device is doing what you expect it to do.
So you are going to control the simulator's location,
meaning the simulator's simulated location.
You're going to control it through Xcode's window,
instead of through the simulator window.
So, when there are a couple facilities for doing this in the simulator as well.
And we're going to bypass that by specifying this track in the Xcode window.
We'll look at that in the case study in more detail.