In last video I added in some code to request permission from the user but I never actually got a pop
up on my device.
Now it's entirely possible that you might have seen a pop up but if you see at one time and you either
approve it or reject it and then refresh the application you're not going to see it again.
So like I said at the end the last video this really throws us into a interesting situation.
How do we effectively really test this stuff.
Well here's what we really need to do depending upon the platform that you're running your application
on whenever we want to test out this permissions stuff we essentially want to reset our permissions
so that we can walk through the case where we accept it and reject it.
I've got some directions here on how we can reset permissions for testing our application depending
upon your environment.
So on I guess we're gonna go through a couple menus on android emulator we're gonna run a command at
the terminal on a physical IOW device you can toggle the location permissions for the Expo application.
Now take note that when we toggle those permissions to either approve or reject location services.
That doesn't actually reset permissions.
It just changes what the choice is and then on Android resetting or changing existing permissions is
slightly different based on version.
So I would recommend you do a quick google search to look up how to change location permissions for
a given application so I'm going to show you how to reset these permissions on an Iowa simulator an
android emulator very quickly.
Once I reset these permissions I should then see a pop up inside my OS device and the android one as
well so on.
IOW I'm going to go to the settings app I'll go to general reset and then reset location and privacy
once I do that I can then go back over to my Expo application refresh the app and then when I go to
chat create I will be prompted to share my location now.
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
IAW that does not throw in air so I don't see any error message here.
Once again that's a bug so I'm not going to go through the same process on Android as well.
Going to first make sure that I reset my permissions so I can test them.
So going to copy that command go to my terminal run that command whenever you run that command you're
automatically going to be thrown back to the home screen.
I'm sorry I'm clicking through some windows here very quickly.
You're gonna be automatically thrown back to the home screen on the android device so you just need
to make sure that you once again run the device or simply run the app on the android emulator.
Now I've got my application back up I can go back to track create and I should see that prompt can't
so I'll go to try create and there's the prompt right there.
So once again at present we're trying to test the case in which we deny permissions.
So I'll tap on deny and now on Android I correctly see a message right here that says Please enable
location services.
So once again if everything was working correctly on ISIS we should see that error message over there.
But right now there is a bug with the expo location library.
All right so it looks like we've handled the heir case successfully so I'm now going to once again reset
permissions on both these devices.
But then this time I'm going to approve the permissions request because that's what we really want to
test here.
We want to test the case in which we have access to all this location stuff.
So once again I'm going to go through the same steps very quickly on ISIS.
I'll reset
and then I'll go back to my Expo app.
I'll refresh and then this time I'm going to always allow location and then on Android I will rerun
that command restart the app.
I'll go back to track create
soon as I can.
There we go.
So here's track create and I will allow all the time.
OK so there we go.
So I've now got both these devices right here with permissions to track location so that pretty much
concludes this permissions code that we've got right here.
We've got the request to get access to the user's location and a little bit of error handling as well.
So now immediately after that await request permissions async right there we can start to add in some
code to actually track the user's location.
Let's take a quick pause right here and start to tackle that in the next video.