This code requests permission, handles permission denial, turns on location with prompt with its respective denial handling and finally tracks the location
This code doesn't entirely belong to me as the tracking part is taken from a StackOverflow answer on this thread https://stackoverflow.com/questions/43318968/how-to-make-a-simple-tracking-android-app-using-android-studio Answered by- https://stackoverflow.com/users/4476671/avinash-verma (Avinash Verma) rest is coded by me
Well, you may delete some unwanted lines of views init. in onCreate, I was lazy to remove those, anyway that wont affect the functioning.
USAGE:
- Create a Map Activity.
- Plug in your API keys.
- Add location permissions to your Manifest.
- Test if basic Map is loading.
- Then simply copy paste the java and xml files in their respective places.