1 00:00:00,890 --> 00:00:03,380 We've now got permission to track the user's location. 2 00:00:03,410 --> 00:00:06,880 Now we can start to add in some code right here to actually start that tracking. 3 00:00:07,010 --> 00:00:11,010 But before we do there's one extremely important thing we need to consider. 4 00:00:11,030 --> 00:00:15,440 Remember the entire goal of our application is to track the user's location as they walk around the 5 00:00:15,440 --> 00:00:16,320 world. 6 00:00:16,340 --> 00:00:17,950 So I got a quick question for you. 7 00:00:17,990 --> 00:00:23,870 How are you going to effectively test this in a dev environment especially if you're running this application 8 00:00:23,900 --> 00:00:25,530 on a physical phone. 9 00:00:25,550 --> 00:00:30,320 Does that mean that whenever we want to test out this map right here we need to like save our code open 10 00:00:30,320 --> 00:00:33,090 up the application and then start walking around the block. 11 00:00:33,110 --> 00:00:35,720 Well obviously that would be really inconvenient. 12 00:00:35,720 --> 00:00:40,550 So we need to think of some way some mechanism we could use to effectively test out our application 13 00:00:40,730 --> 00:00:46,100 and have the user's location change over time without actually walking around the real world with some 14 00:00:46,100 --> 00:00:46,870 test device. 15 00:00:47,540 --> 00:00:51,340 So to do so we're going to use a little bit of trickery here. 16 00:00:51,350 --> 00:00:54,980 First let me tell you that there are a couple of different ways that we can effectively test out an 17 00:00:54,980 --> 00:01:00,770 application that has G.P.S. tracking on a simulated device like the two have got right here. 18 00:01:00,770 --> 00:01:04,580 But these two methods don't work that well if you're on physical devices. 19 00:01:04,580 --> 00:01:10,280 So if you are on simulators you can test out location changes inside of an application using the simulator 20 00:01:10,280 --> 00:01:13,550 or emulator in particular on an OS simulator. 21 00:01:13,580 --> 00:01:19,280 We can go to the menu bar find the debug option and then change the simulated location. 22 00:01:19,280 --> 00:01:25,810 So for example on iPhone over here I can go to debug then location and I can set some different predefined 23 00:01:25,820 --> 00:01:26,930 locations. 24 00:01:26,930 --> 00:01:28,910 I can say there is no location that we're at. 25 00:01:29,180 --> 00:01:35,600 I could put in a custom longitude latitude I can say put me at Apple headquarters or city run bicycle 26 00:01:35,600 --> 00:01:42,470 run in freeway drive will all change location over some period of time to simulate a run a bike ride 27 00:01:42,560 --> 00:01:46,960 or some freeway driving likewise on the android emulator. 28 00:01:46,960 --> 00:01:54,920 We can hit that dot dot dot then go to location so on Android I'll hit dot dot dot right there and I 29 00:01:54,920 --> 00:01:56,710 can pull up location. 30 00:01:56,710 --> 00:02:03,350 So on location I can then change the latitude and longitude or alternatively I could load up a file 31 00:02:03,440 --> 00:02:10,010 called a GP X or came file that has a predefined series of latitude and longitude points I can then 32 00:02:10,010 --> 00:02:15,650 play back those series of points and they will be essentially simulated as the user's current location 33 00:02:15,710 --> 00:02:17,190 on the device. 34 00:02:17,240 --> 00:02:23,060 So clearly there is some mechanism on both iPhone and Android emulators to essentially test out a user's 35 00:02:23,060 --> 00:02:24,200 location. 36 00:02:24,200 --> 00:02:30,530 The downside is that both these I have found are really really buggy with Expo location in particular 37 00:02:30,830 --> 00:02:33,460 for whatever reason on my OS emulator right here. 38 00:02:33,470 --> 00:02:41,030 If I set location to city run and then refresh this thing while tracking my user's location. 39 00:02:41,030 --> 00:02:45,370 Turns out that I'd actually never get some notification about the user moving around in the world. 40 00:02:45,440 --> 00:02:49,580 And again I'm pretty sure that's coming has a bug through Expo location. 41 00:02:49,580 --> 00:02:51,560 So clearly these two solutions right here. 42 00:02:51,560 --> 00:02:52,770 Well kind of buggy. 43 00:02:52,850 --> 00:02:54,460 And they also don't work at all. 44 00:02:54,470 --> 00:02:58,990 If you have a fiscal IOW device or a physical Android device. 45 00:02:59,060 --> 00:03:04,490 So we need some way that we can essentially test the user's location changing over time without having 46 00:03:04,490 --> 00:03:09,050 to deal with these cross platform issues and make sure that it's just going to work 100 percent of the 47 00:03:09,050 --> 00:03:15,250 time even if what we're using is kind of buggy so to actually test out a user's location we're going 48 00:03:15,250 --> 00:03:20,770 to write out a little bit of code to essentially trick the expo location library. 49 00:03:20,900 --> 00:03:25,640 We're going to write out some amount of code that's going to send out some fake readings on the user's 50 00:03:25,640 --> 00:03:31,640 current longitude and latitude over time and we're going to use that as very simply a mechanism to test 51 00:03:31,640 --> 00:03:36,560 out our application effectively while we are just sitting at our desk as opposed to having to actually 52 00:03:36,560 --> 00:03:37,310 walk around. 53 00:03:38,060 --> 00:03:39,990 Now could we have to write out is just a little bit long. 54 00:03:40,010 --> 00:03:44,030 So now that we understand what we need to do let's take a quick pause and write this stuff out in the 55 00:03:44,030 --> 00:03:44,600 next video.