{"id":6409,"date":"2020-06-15T17:46:52","date_gmt":"2020-06-15T17:46:52","guid":{"rendered":"https:\/\/max-drake.cc\/?p=6409"},"modified":"2020-06-16T17:59:09","modified_gmt":"2020-06-16T17:59:09","slug":"location-tracker-with-app-inventor-2-using-phone-sensor-to-google-sheets-and-then-link-to-glideapps","status":"publish","type":"post","link":"https:\/\/max-drake.cc\/?p=6409","title":{"rendered":"Location Tracker with App Inventor 2  using phone sensor to Google Sheets and then link to GlideApps"},"content":{"rendered":"\n<p>I lke GlideApps, they are cool. You can make some great apps with them. But you cannot access youtr phone&#8217;s sensors. So I thought, use App inventor to grab data from phone sensors, send it to google Sheets and then use GlideAppps to access the same google Sheets with that data to make a richer App. This only works for Android, and this is a proof of concept process. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">App Inventor GPS lat\/long capture from phone <\/h3>\n\n\n\n<p>There didn&#8217;t seem to be a video on App Inventor (AI) to Google Sheets. I also haven&#8217;t used  AI for a while now (2017 last used) so I thought I&#8217;d do a couple of basic tutorials on using it. The first was to use this app to get my location and show it on a map- <em>App Inventor, Make An Android App Where My Location In 14 Minutes:<\/em><\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"App Inventor, Make An Android App Where My Location In 14 Minutes\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/yymXeEHyhXI?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>I got the Lat\/Long but it would not open a map in a browser. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"499\" height=\"838\" data-src=\"https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_21-MIT-App-Inventor.jpg\" alt=\"\" class=\"wp-image-6410 lazyload\" data-srcset=\"https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_21-MIT-App-Inventor.jpg 499w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_21-MIT-App-Inventor-179x300.jpg 179w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_21-MIT-App-Inventor-50x84.jpg 50w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_21-MIT-App-Inventor-30x50.jpg 30w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_21-MIT-App-Inventor-100x168.jpg 100w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_21-MIT-App-Inventor-60x100.jpg 60w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_21-MIT-App-Inventor-381x640.jpg 381w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_21-MIT-App-Inventor-457x768.jpg 457w\" data-sizes=\"(max-width: 499px) 100vw, 499px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 499px; --smush-placeholder-aspect-ratio: 499\/838;\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"885\" height=\"413\" data-src=\"https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_06-MIT-App-Inventor.jpg\" alt=\"\" class=\"wp-image-6411 lazyload\" data-srcset=\"https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_06-MIT-App-Inventor.jpg 885w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_06-MIT-App-Inventor-300x140.jpg 300w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_06-MIT-App-Inventor-768x358.jpg 768w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_06-MIT-App-Inventor-50x23.jpg 50w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_06-MIT-App-Inventor-107x50.jpg 107w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_06-MIT-App-Inventor-100x47.jpg 100w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_06-MIT-App-Inventor-214x100.jpg 214w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_06-MIT-App-Inventor-640x299.jpg 640w\" data-sizes=\"(max-width: 885px) 100vw, 885px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 885px; --smush-placeholder-aspect-ratio: 885\/413;\" \/><\/figure>\n\n\n\n<p>So another tutorial, this one inmcorporated the map into app and zoomed in on basic location, but, it didn&#8217;t make a marker. <\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"How to get Your location using MIT App inventor 2\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/ttYOCgERa_g?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>So I used this tutorial to add the marker to the map in the app, it required you to set initial variable values then call them later, lat\/long &amp; marker values (<em>actually, I only think I needed the variable marker with a null initialisation<\/em>) :<\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Placing a Marker on a Map - MIT App Inventor\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/9c7HmAPEe4I?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>So this app worked, finding my current location and putting a marker on the map and zooming into that location (<em>set at 18 (zooms totally to 20)<\/em> <em>may need to be reduced to 16, but can use fingers to zoom out.<\/em>) I also added accuracy as it sometimes stuck marker a little away from my location. It sometimes puts 2 pins in and at start I need to press button 3 times as it starts in Cambridge in England, then zooms to sea somewhere then finally gives my current location. So it would need something to clear the initial marker and refresh.  All in all it works. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"512\" height=\"1024\" data-src=\"https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/Screenshot_20200615-143434-512x1024.jpg\" alt=\"\" class=\"wp-image-6412 lazyload\" data-srcset=\"https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/Screenshot_20200615-143434-512x1024.jpg 512w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/Screenshot_20200615-143434-150x300.jpg 150w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/Screenshot_20200615-143434-768x1536.jpg 768w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/Screenshot_20200615-143434-1024x2048.jpg 1024w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/Screenshot_20200615-143434-50x100.jpg 50w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/Screenshot_20200615-143434-25x50.jpg 25w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/Screenshot_20200615-143434-100x200.jpg 100w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/Screenshot_20200615-143434-320x640.jpg 320w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/Screenshot_20200615-143434-640x1280.jpg 640w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/Screenshot_20200615-143434-384x768.jpg 384w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/Screenshot_20200615-143434-540x1080.jpg 540w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/Screenshot_20200615-143434-scaled.jpg 800w\" data-sizes=\"(max-width: 512px) 100vw, 512px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 512px; --smush-placeholder-aspect-ratio: 512\/1024;\" \/><\/figure>\n\n\n\n<p>A god article here about GPS from App Inventor <strong><a rel=\"noreferrer noopener\" href=\"http:\/\/appinventor.mit.edu\/explore\/ai2\/location-sensor\" target=\"_blank\">Exploring with the Location Sensor<\/a><\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Data to Google Sheets<\/h3>\n\n\n\n<p>The next step is to push the data to Google Sheets. I followed the video below but had a few issues:<\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Send Data to a Google Sheet with  App Inventor #Apps script\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/avpj-k00FmM?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>I tried to cut\/paste from the tutorial code into my own, but that didn&#8217;t work. I needed to change the last function variables to suit my spreadsheet.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nvar ss = SpreadsheetApp.openByUrl(\"https:\/\/docs.google.com\/spreadsheets\/d\/1TWsWFZqVLuR5touj0mNQOFmg8793kr0oMOFYagTL_gE\/edit#gid=0\");\nvar sheet = ss.getSheetByName(\"DataIn\");\n\n\n  addUser(e,sheet);\n}\n\nfunction doPost(e) { \n  var ss = SpreadsheetApp.openByUrl(\"https:\/\/docs.google.com\/spreadsheets\/d\/1TWsWFZqVLuR5touj0mNQOFmg8793kr0oMOFYagTL_gE\/edit#gid=0\");\n  var sheet = ss.getSheetByName(\"DataIn\"); \n  \n  addUser(e,sheet);\n}\n\n\nfunction addUser(e,sheet) {\n  var num = e.parameter.num ; \n  var latx = e.parameter.latx ; \n var longx = e.parameter.longx ;\n\n  sheet.appendRow(&#91;num,latx,longx]);    \/\/ sheet.appendRow(&#91;num,lat,long]);\n}\n<\/code><\/pre>\n\n\n\n<p>Also the <strong><span style=\"color:#cf2e2e\" class=\"color\">major issue<\/span><\/strong> that I cam across was the updating of the code. If you publish to web , <span style=\"color:#cf2e2e\" class=\"color\"><strong>when you update you must ensure that you change the revision<\/strong><\/span>, otherwise, even though you have a renewed URL you still have the original code. This flumoxed me to such a degree that I had to build the tutorial app from the viodeo to see the spreadsheet being populated, so hours wasted on a fundamental error, one of my classic mistakes. So although I was de-bugging by putting in simple data (rather than Lat\/long coordinates) it still did not populate the spreadsheet. I finally got there. <\/p>\n\n\n\n<p>So now I can push data into the spreadsheet. <\/p>\n\n\n\n<p>Next I made a simple GlideApp that plotted the locations on a map. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"454\" height=\"958\" data-src=\"https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-16-14_22_00-AppInv-LocTracker2-\u00b7-Glide-\u00b7-Create-Apps-from-Google-Sheets.jpg\" alt=\"\" class=\"wp-image-6413 lazyload\" data-srcset=\"https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-16-14_22_00-AppInv-LocTracker2-\u00b7-Glide-\u00b7-Create-Apps-from-Google-Sheets.jpg 454w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-16-14_22_00-AppInv-LocTracker2-\u00b7-Glide-\u00b7-Create-Apps-from-Google-Sheets-142x300.jpg 142w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-16-14_22_00-AppInv-LocTracker2-\u00b7-Glide-\u00b7-Create-Apps-from-Google-Sheets-50x106.jpg 50w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-16-14_22_00-AppInv-LocTracker2-\u00b7-Glide-\u00b7-Create-Apps-from-Google-Sheets-24x50.jpg 24w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-16-14_22_00-AppInv-LocTracker2-\u00b7-Glide-\u00b7-Create-Apps-from-Google-Sheets-100x211.jpg 100w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-16-14_22_00-AppInv-LocTracker2-\u00b7-Glide-\u00b7-Create-Apps-from-Google-Sheets-47x100.jpg 47w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-16-14_22_00-AppInv-LocTracker2-\u00b7-Glide-\u00b7-Create-Apps-from-Google-Sheets-303x640.jpg 303w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-16-14_22_00-AppInv-LocTracker2-\u00b7-Glide-\u00b7-Create-Apps-from-Google-Sheets-364x768.jpg 364w\" data-sizes=\"(max-width: 454px) 100vw, 454px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 454px; --smush-placeholder-aspect-ratio: 454\/958;\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Time Issues<\/h4>\n\n\n\n<p>This is a bit of a twisty one. If you use Google Forms to put data into Google Sheets then you automatically get a timestamp. BUT, if you fire from App Inventor to Google Sheets that is not the case. <\/p>\n\n\n\n<p>Now , there may be a time trigger you could use if a new row is added into Google Sheets, most probaby with a GAS script, but I was trying to do it in App Inventor. <\/p>\n\n\n\n<p>I added the Clock to the App and then Added another variable to my output for time. I had several goes at this and the app got naffy about it and wouldn&#8217;t wortk. In the end the below logic works BUT it sends a number to the google sheet:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"885\" height=\"670\" data-src=\"https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_49_21-MIT-App-Inventor.jpg\" alt=\"\" class=\"wp-image-6414 lazyload\" data-srcset=\"https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_49_21-MIT-App-Inventor.jpg 885w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_49_21-MIT-App-Inventor-300x227.jpg 300w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_49_21-MIT-App-Inventor-768x581.jpg 768w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_49_21-MIT-App-Inventor-50x38.jpg 50w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_49_21-MIT-App-Inventor-66x50.jpg 66w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_49_21-MIT-App-Inventor-100x76.jpg 100w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_49_21-MIT-App-Inventor-132x100.jpg 132w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_49_21-MIT-App-Inventor-845x640.jpg 845w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_49_21-MIT-App-Inventor-640x485.jpg 640w\" data-sizes=\"(max-width: 885px) 100vw, 885px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 885px; --smush-placeholder-aspect-ratio: 885\/670;\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"223\" data-src=\"https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_52_47-AppInv-LocTracker2-Google-Sheets-2-1024x223.jpg\" alt=\"\" class=\"wp-image-6417 lazyload\" data-srcset=\"https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_52_47-AppInv-LocTracker2-Google-Sheets-2-1024x223.jpg 1024w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_52_47-AppInv-LocTracker2-Google-Sheets-2-300x65.jpg 300w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_52_47-AppInv-LocTracker2-Google-Sheets-2-768x167.jpg 768w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_52_47-AppInv-LocTracker2-Google-Sheets-2-50x11.jpg 50w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_52_47-AppInv-LocTracker2-Google-Sheets-2-230x50.jpg 230w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_52_47-AppInv-LocTracker2-Google-Sheets-2-100x22.jpg 100w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_52_47-AppInv-LocTracker2-Google-Sheets-2-460x100.jpg 460w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_52_47-AppInv-LocTracker2-Google-Sheets-2-640x139.jpg 640w, https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-17-12_52_47-AppInv-LocTracker2-Google-Sheets-2.jpg 1072w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/223;\" \/><\/figure>\n\n\n\n<p>So we have to change that number to a date\/time format. I found an article in StackOverflow : <a href=\"https:\/\/stackoverflow.com\/questions\/22941399\/appinventor-how-to-insert-datetime-into-google-spreadsheet-and-show-only-recent\">AppInventor: how to insert DateTime into Google Spreadsheet and show only recent DateTime<\/a><\/p>\n\n\n\n<p>Basically you have to use miliseconds and then convert the number (lets call it <span style=\"color:#cf2e2e\" class=\"color\">X<\/span> for the time being by:<\/p>\n\n\n\n<p>(<span style=\"color:#cf2e2e\" class=\"color\">X<\/span>\/ 86400000) + 25569<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>To generate this number, start with AI&#8217;s Millisecond function. NOTE: Both GS and AI use milliseconds, but they have different 0 points, so you have to manipulate the result a bit. The formula I&#8217;ve used in AI in the past is this:<\/p><p><code>GS Date\/Time = (Clock1.GetMillis(Clock1.Now) \/ 86400000) + 25569<\/code><\/p><cite>https:\/\/stackoverflow.com\/questions\/22941399\/appinventor-how-to-insert-datetime-into-google-spreadsheet-and-show-only-recent<\/cite><\/blockquote>\n\n\n\n<p>Also, in Google Sheets you have to adjust the millisecond number into a Date\/Time format. <\/p>\n\n\n\n<p>So that was a long winded process , but it works. Once you have the data you can calculate duration between points to get overall time. No using forms but string manipulation. <\/p>\n\n\n\n<p>Another method to get a timestamp at each marker is to use Google forms to push your data from App Inventor to Google sheets, as per the video below:<\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Send Data to a Google Sheet with  App Inventor\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/AMQ7hL7fNUQ?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">End comment<\/h3>\n\n\n\n<p>The process went pretty well. Accuracy of data wasn&#8217;t that great, but a good starting point for testing. <\/p>\n\n\n\n<p>I&#8217;ve been thinking of the interface between the Apps for a while so nice to see some successful information transfer. <\/p>\n\n\n\n<p>Thinking about the compiling of the app, there is an issue of hardcoded link to web app URL. <strong><span style=\"color:#cf2e2e\" class=\"color\">LocTracker2.aia<\/span><\/strong> file for people to compile it themselves is <strong><a rel=\"noreferrer noopener\" href=\"https:\/\/drive.google.com\/file\/d\/12lnPvBKeQjcG_54YRW9XU6UNOkerzL0B\/view?usp=sharing\" target=\"_blank\">HERE<\/a><\/strong>. Click on download button.<\/p>\n\n\n\n<p>I made two videos about this process, the first a more general overview:<\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"GlideApps unlocking Android phone sensor data via Google Sheets with App Inventor\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/Yd-ZOL7Bmn8?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>The second on how I built the 2 apps:<\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Build App Inventor App for Location Data for GlideApp Map\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/w2AuwJ8WAas?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>The 3rd video on time\/date issues between AI &amp; Google Sheets.<\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"DateTime in App Inventor App for Location Data for Google Sheets &amp; GlideApp Map\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/3wWPEvl8Yt8?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>I lke GlideApps, they are cool. You can make some great apps with them. But you cannot access youtr phone&#8217;s sensors. So I thought, use App inventor to grab data from phone sensors, send it to google Sheets and then use GlideAppps to access the same google Sheets with that data to make a richer [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6411,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[204,32,441,6,29],"tags":[],"class_list":["post-6409","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-automation","category-power-bi","category-glide-apps","category-maps","category-web"],"featured_image_src":"https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_06-MIT-App-Inventor.jpg","featured_image_src_square":"https:\/\/max-drake.cc\/wp-content\/uploads\/2020\/06\/2020-06-15-12_32_06-MIT-App-Inventor.jpg","author_info":{"display_name":"Max Drake","author_link":"https:\/\/max-drake.cc\/?author=1"},"_links":{"self":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/posts\/6409","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6409"}],"version-history":[{"count":0,"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/posts\/6409\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/media\/6411"}],"wp:attachment":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6409"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6409"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6409"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}