The steps below require a smartphone running Android. If you're an iPhone user you'll have to find an appropriate iOS app for step #4. Maybe this?
- Copy this HTML file to wherever you want your page to live.
- Create an account at MapBox and generate an API token on your account page.
- Replace my API token with yours in the HTML file.
- Install GPS Logger for Android on your phone.
- Create an account at ThingSpeak and get an API key. We'll use ThingSpeak to store your GPS coordinates.
- Create a new ThingSpeak channel. Enable all eight fields and make the channel public. It should look like this.
- Replace my channel ID with yours in the HTML file. Your channel ID can be found at the top of your channel's settings page.
- Open GPS Logger for Android and tap the menu and go to the "Logging details" screen.
- Enable "Log to custom URL" and add
https://api.thingspeak.com/update?api_key=YOUR_THINGSPEAK_API_KEY&field1=%TIME&field2=%LAT&field3=%LON&field4=%SAT&field5=%ALT&field6=%SPD&field7=%DIR&field8=%BATTas the URL (replacingYOUR_THINGSPEAK_API_KEYwith your ThingSpeak API key). We'll actually only use the LAT and LON fields (field2 and field3) but you might as well log the other stuff because hey why not. - Explore GPS Logger for Android's other configuration options. For example, under "Performance", I set the logging interval to 300 seconds so that it'll push my location to ThingSpeak every five minutes. I also set a distance filter of 30 meters so that it won't log my location if I'm still in the same spot I was five minutes ago.
- Tap the "Start Logging" button from the app's home screen and wait a few seconds for it to log your position.
- Cross your fingers and open your HTML file in a browser!
Leave the app running on your phone in the background whenever you want tracking enabled. Oh, and you'll probably want to replace the location marker image. 😄
Thank you, I'll try this. Very helpful.