1 00:00:01,050 --> 00:00:05,450 In last video I added in some code to request permission from the user but I never actually got a pop 2 00:00:05,450 --> 00:00:06,890 up on my device. 3 00:00:06,890 --> 00:00:11,660 Now it's entirely possible that you might have seen a pop up but if you see at one time and you either 4 00:00:11,660 --> 00:00:16,260 approve it or reject it and then refresh the application you're not going to see it again. 5 00:00:16,280 --> 00:00:20,810 So like I said at the end the last video this really throws us into a interesting situation. 6 00:00:20,810 --> 00:00:22,760 How do we effectively really test this stuff. 7 00:00:23,570 --> 00:00:28,580 Well here's what we really need to do depending upon the platform that you're running your application 8 00:00:28,580 --> 00:00:33,380 on whenever we want to test out this permissions stuff we essentially want to reset our permissions 9 00:00:33,770 --> 00:00:37,870 so that we can walk through the case where we accept it and reject it. 10 00:00:37,880 --> 00:00:42,470 I've got some directions here on how we can reset permissions for testing our application depending 11 00:00:42,470 --> 00:00:44,070 upon your environment. 12 00:00:44,240 --> 00:00:49,220 So on I guess we're gonna go through a couple menus on android emulator we're gonna run a command at 13 00:00:49,220 --> 00:00:56,640 the terminal on a physical IOW device you can toggle the location permissions for the Expo application. 14 00:00:56,660 --> 00:01:01,790 Now take note that when we toggle those permissions to either approve or reject location services. 15 00:01:01,790 --> 00:01:04,190 That doesn't actually reset permissions. 16 00:01:04,190 --> 00:01:11,290 It just changes what the choice is and then on Android resetting or changing existing permissions is 17 00:01:11,290 --> 00:01:12,660 slightly different based on version. 18 00:01:12,670 --> 00:01:17,050 So I would recommend you do a quick google search to look up how to change location permissions for 19 00:01:17,050 --> 00:01:22,540 a given application so I'm going to show you how to reset these permissions on an Iowa simulator an 20 00:01:22,570 --> 00:01:24,790 android emulator very quickly. 21 00:01:24,790 --> 00:01:29,560 Once I reset these permissions I should then see a pop up inside my OS device and the android one as 22 00:01:29,560 --> 00:01:31,110 well so on. 23 00:01:31,130 --> 00:01:42,230 IOW I'm going to go to the settings app I'll go to general reset and then reset location and privacy 24 00:01:43,470 --> 00:01:49,620 once I do that I can then go back over to my Expo application refresh the app and then when I go to 25 00:01:49,620 --> 00:01:54,200 chat create I will be prompted to share my location now. 26 00:01:54,210 --> 00:01:59,250 Right now we are trying to test out the error case so I'm going to say don't allow it like I said on 27 00:01:59,260 --> 00:02:02,850 IAW that does not throw in air so I don't see any error message here. 28 00:02:02,850 --> 00:02:07,850 Once again that's a bug so I'm not going to go through the same process on Android as well. 29 00:02:07,970 --> 00:02:11,520 Going to first make sure that I reset my permissions so I can test them. 30 00:02:11,520 --> 00:02:19,670 So going to copy that command go to my terminal run that command whenever you run that command you're 31 00:02:19,670 --> 00:02:23,780 automatically going to be thrown back to the home screen. 32 00:02:23,780 --> 00:02:25,850 I'm sorry I'm clicking through some windows here very quickly. 33 00:02:25,910 --> 00:02:29,540 You're gonna be automatically thrown back to the home screen on the android device so you just need 34 00:02:29,540 --> 00:02:35,130 to make sure that you once again run the device or simply run the app on the android emulator. 35 00:02:35,150 --> 00:02:41,250 Now I've got my application back up I can go back to track create and I should see that prompt can't 36 00:02:41,280 --> 00:02:44,760 so I'll go to try create and there's the prompt right there. 37 00:02:44,820 --> 00:02:48,840 So once again at present we're trying to test the case in which we deny permissions. 38 00:02:48,840 --> 00:02:54,360 So I'll tap on deny and now on Android I correctly see a message right here that says Please enable 39 00:02:54,360 --> 00:02:56,190 location services. 40 00:02:56,190 --> 00:03:00,590 So once again if everything was working correctly on ISIS we should see that error message over there. 41 00:03:00,660 --> 00:03:04,640 But right now there is a bug with the expo location library. 42 00:03:04,850 --> 00:03:09,780 All right so it looks like we've handled the heir case successfully so I'm now going to once again reset 43 00:03:09,780 --> 00:03:11,470 permissions on both these devices. 44 00:03:11,580 --> 00:03:16,320 But then this time I'm going to approve the permissions request because that's what we really want to 45 00:03:16,320 --> 00:03:16,710 test here. 46 00:03:16,710 --> 00:03:20,480 We want to test the case in which we have access to all this location stuff. 47 00:03:21,430 --> 00:03:26,850 So once again I'm going to go through the same steps very quickly on ISIS. 48 00:03:27,040 --> 00:03:27,910 I'll reset 49 00:03:31,970 --> 00:03:33,680 and then I'll go back to my Expo app. 50 00:03:33,820 --> 00:03:42,010 I'll refresh and then this time I'm going to always allow location and then on Android I will rerun 51 00:03:42,010 --> 00:03:47,760 that command restart the app. 52 00:03:47,960 --> 00:03:49,430 I'll go back to track create 53 00:03:52,080 --> 00:03:52,860 soon as I can. 54 00:03:52,860 --> 00:03:53,360 There we go. 55 00:03:53,850 --> 00:03:56,420 So here's track create and I will allow all the time. 56 00:03:57,340 --> 00:03:58,320 OK so there we go. 57 00:03:58,320 --> 00:04:03,720 So I've now got both these devices right here with permissions to track location so that pretty much 58 00:04:03,720 --> 00:04:06,140 concludes this permissions code that we've got right here. 59 00:04:06,150 --> 00:04:12,140 We've got the request to get access to the user's location and a little bit of error handling as well. 60 00:04:12,290 --> 00:04:16,320 So now immediately after that await request permissions async right there we can start to add in some 61 00:04:16,320 --> 00:04:18,710 code to actually track the user's location. 62 00:04:18,810 --> 00:04:21,930 Let's take a quick pause right here and start to tackle that in the next video.