GlideApps unlocking Android phone sensor data via Google Sheets with App Inventor


hello I'd like to do this is Mexico I'd like to talk to you about this app here which is basically a map with a whole lot of locations pins and markers in for where I actually you went on a trial so that I've got all of these locations and I can actually put pins in a map like that if we just look at apply that generally over all the things that you can do with the glide up if we look at the components you've got your text and you've got your tables and separators and titles you can hook in media by you can put in an image you can put in audio you can put in map and video and you've got some busted some things so all of these can be done by URL just like a YouTube or something like that email you're actually just getting a a mail to link and phone numbers and all of these sorts of things so and you've got a couple of switches here which are an activity which it buttons really in their own sort of ways and you can fill out forms and you can put some data in and you can do some text entry so in some ways these are all things that you can do in a browser actually hasn't got anything to do with the actual device that you actually have and it hasn't got anything really to do with the sensors on that device so you can't actually access all the sensors now one interesting thing in the map that I'm actually come across and I haven't been playing with right after a while is that if you press on this location it says allow location access and if you wall up onto that a little blue daughter come up and say where you are now what that is using is in fact a HTML geolocation API in fact it's a bit of JavaScript there's going and calling and getting that current position now the thing is there is a privacy issue that since this can compromise privacy the position is not available in this year user approves it so this you control whether you actually give that a location data with that particular point I came across this when I was doing some nodejs playing and this particular chapter is more to do with the API so I was interested in that and I learnt about it then but anyway when I started to look about that I suddenly thought well how can I actually get the sensor data now I started to pull down a couple of that's GPS apps on my Android phone and a lot of them would do things one of them would actually get your GPS things at intervals and it would push it to a CSV a CSV file and things like that but I wanted something that would actually be able to push into Google sheets if I can push it into Google sheets I can then reach in using glide apps and actually grab that information so I looked at this tool called App Inventor and I did a few tutorials so there's one where's where's my location and this one here uses the process of afar's your latitude and longitude using this location sensor on the phone and then it then uses an activity started to try and open up a browser with Google Maps and then hopefully puts a pin on there or a marker on there that didn't quite work out I then found another tutorial this one here that actually a debt was a tracker app that actually found your location but it wouldn't put a marker on there but it just zoomed in with latitude and longitude right in the middle and had a certain zoom level on the map but it didn't actually show you where you were so any luck finding another one that would actually put a place a marker on a map and I use that bit of code to actually add that so I then started to get the app that looked like this you press the button on the location and it gives you your latitude and longitude but then I press the button three times and I've got three different locations so there's an issue there with accuracy of the data that was actually coming in the next thing I needed to think about so anyway the next thing I did was I actually brought down another line through here that actually gave the accuracy of the estimated accuracy off of that reading then it came through and the next one that I actually had dude would go through and do a tutorial and find a tutorial where I can push the App Inventor through into a Google sheet on this one here there's just two buttons you press the button and then it pushes some stuff onto the Google sheet through there and there's a little list picker through here and depending on what you list it puts it into one cell and then you changes to the next cell so I then got this little bit of code that would actually do that part of the process so when we actually just jump across to the actual App Inventor a thing like that I've been I played with this a few years ago so a lot of these are from July 2017 and so I started to look at it again because I found that you could actually push information through to Google sheets I suddenly thought ah this is where it starts to make sense so it has two sorts of interfaces here it actually has the image of the screen so you can actually have multiple screens and you can put things on different screens and then you actually have the kind of block logic logic that you plug to now this is an online tool so basically you just log in and then you actually start building your own projects as you go through now when we go back to the designer side of things the interesting things is we have user interfaces so that we can put up buttons and checkboxes 'im images blablabla the normal stuff this spinner one is actually just a list you just pull down list and and there but the other interesting thing about is that it can reach in and get things like your location sensor so it's using the phone's location sensor or you can get a light sensor if you've got which would be your camera light meter their little a to use it can use accelerometer if you had a near field RFI ID think it would use that if you've got a fancy phone that does that if you have a pedometer I think he's used the either using gyroscope or and seller aa meter so I can most probably do that so there's certain things in the user interface we can put a button so here's an obvious button I can drag another button across and put a button down there and there we can see a button some of the things the sensors are not visible so the other thing that we can actually do is that we can pull a camera in here so we can have a button on a certain screen and we can say take a picture and then it can bring up that picture onto that it can do a camcorder it can play sound so you can do a sound recorder so we can actually capture information so this is a thing that can capture information so we got that last button there button too we don't want that so we're just going to delete that now and delete that there but the things which are not visible they sit down here at the bottom now I just want a highlight here on this particular exercise that I'm doing I get a location every time I press that button so it's not an interval thing at this one here but it does have an interval here where you can set it and just say as soon as I start their app off every I think it's there's a millisecond so that's a second and that's a minute and I think that's about half an hour so we can do it in point one of them a second if you needed to do wait to go through and do reason so you can set something so if you were doing an activity you could go start at the beginning do your activity and in the end you just stop and if it was doing reading for lunch chasers like you were on the run it would actually just take those locations at specific points so that's the the pretty side of the thing of you you've actually got the screens and what you want to do and then on the second side you've actually got the blocks now the blocks are sort of a logic so if we look at the location center it has these things here so the location Center says when you get the location that's changed what you want to do now with that when you've got the location it's actually got these things so they can actually give information from so you could say if a status has changed you know what happens through that maybe it's a different provider or something's happened or they get a latitude from an address so it's actually converting an address into a latitude and you'd get a latitude from address so that's where you've got a Jiro address or a geo lat/long so he's got all these other things that you can sit in and if you see on the actual coding the way that you do it you plug things in either they nest inside or they plug in and then you can set things like I have a few labels so if we just go back to the designer and if I just click on here sorry I'll click on a label here and it's invisible because if I type some text you'll see there's some text in there but I've actually hidden it because that's where I actually want to put my latitude and longitude so when I actually test the device it'll come up and give me the latitude and longitude so again if you look on this post here that's what our ID here I had the latitude and longitude but what I was finding I was getting I also wanted to put accuracy down as well so again as I ended up going through on the blocks first of all I just had latitude and longitude then suddenly I wanted a teacher accuracy so inside the location center sensor I can actually get the accuracy and I could also get altitude and may be available providers I'm not too sure where that is and so there's a few other little toys there I haven't played with it was really just an exercise to do this now on the third tutorial second tutorial I was doing I needed to set a pin so I actually had to make this an IQ had to in this like the global market and zero so and then the second thing that I needed to do was one that when you actually push the button it goes and gets the latitude and longitude when you press that button so it's got it at that particular point in time and then it does a zoom level there and so it shows it on the map and then the other thing that it actually does as well so it sent us a map onto that particular point and then here actually I've got this web script through here and inside there I post these bits of data so when I think of number field go and give me the accuracy of the thing and then give the latitude give me that give the longitude here in that there there so on that third one there I actually have the accuracy and it's coming through here and then I've got the latitude and the longitude and just recently I've actually just added altitude as well so that's another thing that's being fed through so this is quite nice to do now I can do a tutorial on the MIT information about how I built this if people are interested then they just have to put something in the comments down below so what I'm doing is basically I'm capturing that information as I'm going around and as I said I've got it set for pushing the button because I actually just want to go and test it in different locations but what I was finding when I was pinning their head look at the accuracy 26 meters four point seven meters 19 meters lot of 20 meters some of them so there's a little bit of an ambiguity there so when we actually look at the actual map itself there I actually went down this little track down here and then up to the loop through here and back but you see a lot of them are bunching so there where there seems to be a little bit of accurate also I was up by the road here but somehow I got right up to the top of the lookout so that doesn't matter so what it does is it gives you real-time data that you can actually push in and you can actually retrieve again in your actual app and display those things as you go through this is pulling it in onto this sheet and then I've got another sheet here where I've got the address now to put an address to get a pin on the actual map through there you need for the address the latitude then a comma then the longitude and then so to do that it's just a bit of concatenation up there now I should be doing an array formula through here so that anytime there's an update on this sheet here it goes and updates through here but it's more just a proof-of-concept at this point in time so this is just using one of the sensors now again this has a whole lot of other sensors that we can use we've got other interface items that we can use we can use a whole lot of screens we can actually add capture media stuff things like capturing cameras and things like them some of the things that it does it's got its own storage that you can actually build and make a tiny DB or a tiny web DB or a cloud DB or a farm than you actually want to say things to or there's an experimental one that's coming through which is a firebase DB now far base DB is a Google DB cloud DB that you can actually use so I think that's what Glide X were using and listening when they started off with the photos when you had the photos that you had they put them into the firebase and then you end you up with the URL so there must be some way that you can link Google sheets across the firebase oh I actually haven't done that and maybe that's an exercise later on so anyway at this point in time we don't want to store our data in any of these although we could store it and do some manipulation and these ones here sorry they're sensors and then there's connectivity things like we can connect to the web which we're doing down here as well so that's where we're connecting to the web and we're sending our data across through to this information across to the sheets there how's that done well inside that particular sheet that actually has that location there we've got a little bit of a script that we actually had to put in here now this is the script that I got from this tutorial through here and they've got a link to there but he could see I actually had to edit it now that was quite useful in editing that sheet because they only had two parameters and I've ended up with something like four parameters now one of the things is that when you makes Lee done this and you've saved it you end up publishing it and deployed as a web app now this is where I got into a little bit of trouble is that when I deployed it as a web app I wasn't putting a new version every time I updated it so every time I thought I got a new URL for the code which I was copying from here and pasting into this particular point here for the web app so that's where it's sending the data to then push all of that stuff onto that sheet because I wasn't updating this it just kept on giving me the old data all the time so that was really never me up now there's a couple of other little features about this MIT app that I just want to highlight as well first of all there's ways of testing it now there's a way that you can you a USB so you can take from your PC and plug in your phone as long as it's an Android phone and you can load up some software onto there and then you can as you update your code through here and test it you can actually do it on your phone the other way that you can do it is a thing called an emulator you need to drop some code some more code onto your computer and this runs a small server so it's running a little server on your computer and then with that computer it then opens up this emulation of a mobile app and then this takes about two to two-and-a-half minutes after you started up the first time but then when you alter the code it speeds up and does something like that but because it's an emulator it's in sort of infinity space or something it doesn't seem to be able to pick up the IP address so therefore he can't do latitude and longitudes so all I was doing was sending it somewhere dumb as just putting instead of putting actual location – friend I was actually putting things like that copying to be something like a number one in there and just to see what was coming through because I thought when I was having problems the problems was because I was actually having these particular tools on there which wasn't the case anyway that goes and move on by by without so this is a tool now they have a couple of beautiful things that you can do like glide apps through here so glide apps I want to share this with somebody I can actually just give them the copy of the link and then just send that off with MIT and what you actually could do is I'm just going to fire this up now and you'll talk over a few more bits is that you can go you can download apk which is an app thing for running an app on your on your phone and an M file so you can run that you can put it to your computer copy it across or email it to your phone to do that or you can do this one via a barcode now this thing compiles the code and makes it into an apk file and once it does that you'll see a little QR code that you can use and it also gives you a link so when it gives you the link through here that link only lasts for a couple of hours because they don't really want a whole lot of people generating these things on and off all the time the other issue with this is that so there is so this QR code and this only were for a while but because you can actually download and once you've actually downloaded the app to your PC you're using it the other thing is because if you're debugging and you're doing this a number of times instead of actually copying over writing the previous app it just makes another copy of it so suddenly you might end up with 25 copies of lock tracker to dot and then in brackets 25 dot a PK so you might have to go and clean your phone out if you're testing it that way so that's another little issue with that the other thing as well is that if you compile this and you build this and you give this to somebody else to use you can it be Mogador because of the fact that this is linking to my sheet here so if you want something generic you sort of stuffed so what you can actually do and this is the beauty of this app as well so that's fine if you actually give somebody else like that and say oh well if you go and do that test it'll come on to this particular glide app that we're all sharing together and that's fine if two of you or three of your gathering data or you're doing a project or you're doing surveys or you're all doing a team effort thing where you're running around and you want to capture all those stars of the different things that you're doing that's fine to do but if you don't want to do that you don't want to compile it and build it and send them the empty so you don't want to do that but what he can do and this is another beautiful thing of this one here is it you can export the code as this so you can export it as a dot a I pay now I'll leave a copy of this in the link to the video and so when you actually come in you actually just open up your browser with your one in here and you import that dot a IFR and you bring it in like this and then you can then alter it as you want like you suddenly saying well actually only want latitude longitude I don't want accuracy and I don't want help shoot so I'm just gonna blow this other crap away so you can do that quite easily so these are things you can do or else you can sunny say well actually another thing that I would like on mine is a time step and then what you'd actually have to do is that you'd also link it via here first of all to your own script a sheet and also to your own specific tab that you're doing it so that's linking to this sheet and it's linking to that tab and it's actually saying go and get the info gone get that sheet and that tab and then go and get do a post on that and and then get these parameters from that and then on this sheet append a row with none that that met and so it appends another row with that that that and that and so that's what it's doing there so that's quite good so another little step forward from this that I was thinking well okay then you you you you use this tool to go and grab your data so you really want a little bit of a minimalist tool in a way you actually want it with a but to kind of say do this or do that you may want to do a better check in on your on your stuff yourself but basically what you're trying to do is to push your sense of stuff into your Google sheets now when you're actually in your Google sheets you can start doing some manipulation like you can suddenly saying well what is the distance between these two points well as it is if you actually look the accuracy is not that good because I've got a whole load of zeros they've got exactly the same number but after a while they change so because of the actual walk is actually in a Luke I started here went all the way down here and then came all the way back if I just took the first point in the last point I'll end up going zero distance in half an hour or whatever I did so what I've actually got to do is look at the difference of every single one of these so when I've actually done is I've gone through and said well this is my latitude this is my longitude each one here I've got the difference in latitude difference in longitude now because I want latitude and longitude I've got two sides of a triangle so to get the hypotenuse on the distance between these two points like two that actually work like these two here I've got to get the hypotenuse so there then the square of the hypotenuse is equal to square the other two sides so here I've got the square root and those are all the modifications that I've just want to get there so that I can get a total sum of the total distance that I've got but because my pins are a little bit not quite where I actually went and because of the accuracy of my dart is not exactly brilliant I'm gonna have to put a fudge factor into here so the only way I can get that fudge factor is to go and do that loop four or five times get the data average it out or even use Google Maps and actually just run a sorry Google Earth or something and run up and point all the way around to actually get the total distance of a thing and then I can actually see how accurate it is so that I can the total distance that I usually did and again you could put timestamps onto here or you can do a start and a stop time as well to do those sorts of things again just talking back with that MIT app as well inside the blocks if I've actually got the location Center one of them I think actually has a time time interval so there are some time interval things that you can eighty grab off those there's also within the designer thing as well in the media I think it is somewhere user interface there's a clock somewhere you win a big plop plop there you are so you could do it time through that as well so there's different ways you can do this so this is sort of almost the opposite Glide is is such a good general thing but it also has a very nice interface I think the screens and the whole layout is actually quite beautiful but in some ways it hasn't got specific information so we've then got to actually create an app that we've actually got a load up onto our PC or sorry onto we're phone itself to do now again a tiny Android but you then have to have one widget to in specific but it's going unique data based on your phone alone so what this is doing is then populating your Google sheets that you can then manipulate a just calculate do different things with if you get your sensor with light levels and things like that you might actually want to look at averages of light levels or all sorts of different things based on certain factors that you're doing but you're using centers cameras there all those sorts of things and you're just pushing through so the essence of this that I've come across and one of the things is this is giving you specific unique stuff based on sensors on your phone it's not that accurate but we can identify their accuracy to use that as a thing that we can actually add a fudge factory near-miss only saying because of that actually it was about a 1.

1 3 extra so I then just multiply that out and the total distance I did was actually 1.

5 one and a half K and and I did that in so many so my move moving with that there you see on those ones we lock in those ones all the way through we could actually have something like an accelerator accelerometer accelerometer sensor through there to suddenly say in the middle of our walk or something we're going to do a sprint thing and we can actually capture that information through there of changing speeds and so inside the location sensor one again when we were looking at that and we were looking at the blocks of the location sensor one there there was a thing on speed they can do so the difference in speed as you jump between two different points as well so there's a lot of intelligence that they can use and we can use it we can grab the information from here we can process the information within the Google sheets and then we can present that information in a very aesthetic way inside the glide app so I hope that's been of interest to you be aware again I will upload and I will get give you the data I'll save it as a dot a IFR so that you can actually get access to that as to see what I've done I'll give you a link to this particular article or post that I'm acting writing I'll also link to this so the Geo codes are so you know what the NGO location API send this and to the map so if you wanted to work out the difference because of the difference difference of latitudes and things like that the difference degrees to actually get the meters and and miles etc there are some bigger formulas to user you could use those instead and that was just a quick and dirty way of actually suddenly saying well how do I convert a left long into a I think also I'm not too sure about whether I can push this accuracy any further maybe there is a method maybe there isn't but the the the other thing that I want to point out here is that I went on to the Google app side and you can download apps that do something the nice thing with this although this is again they're both no codes this and Google and Klein answer sort of no code although within glide out there is this power of using the gas that Google Apps scripts in the background as well and this is really just a cut and paste you only actually have to change a couple of little button little bits down here for this one but as I said I'll do a tutorial on that if there's a request for that sort of thing but this is this is a sort of an O code but you can grab this specific data that you want so you can build this to what you want to capture and what you actually want to use in the glide app once again you see the other thing as well is if you build it for somebody else you were then or you know like let's just say you were a fitness place and you actually wanted to get the data now you could push it all onto one sheet and give everybody a different sheet name to push thing to and therefore you can actually build the app or maybe you've got to link this to a different app and sorry a different sheet each time depending on the individual is done through so which time you might need to build but the actual build process is not particularly slow authorities it's pretty fast to add to HD do the QR code and to think like that can be done but once you actually got the thing worked out right and the only thing that you actually need to change there is that little bit of code there so all you're doing is just linking to another sheet and pushing it somewhere else so there is that Binford's so in some ways because this is a sort of a as a uniqueness to it the way that it's done and you're going on that specific sheet they're compiling and giving somebody a build may not be the best way to do it the best way to do it may be to actually give them an AIA file to do so just be aware of that I'm not too sure if there's a way of getting a button to be able to put that information into that particular link there might be kind crying in which case you could actually just do that as a different methodology I'm not too sure whether or next for that or not it's just the notion and to a certain extent because this is an individualization it is rather specific for the data that you're capturing with the phone that you're using down upon so we sort of built specifically for those sorts of things so again they're more general and the more specific I hope you like the video if you found it useful can you please give a thumbs up if not Doctor.

Leave A Reply

Your email address will not be published.