 Let me share this. OK, cool. So we got it here, Android. So the title will be, Honey, There's a Titan in my Android form. All right, so join me in clapping for James. Good. OK, so today I'm representing as the title that I have, Honey, There's a Titan in my Android form. Now, what am I going to share over here on this thing? So first thing I'd like to talk about the title. So title, probably, I don't think quite numbers of you might have heard of this movie. It was a very old movie. This took to the titles come, Honey, I Stunt the Kicks, which is a movie in 1989. I remember I watched that when I was nine or 10. I can't remember it, but I like this movie. And it goes one and two. So if it happens to know this movie, please watch that again. I still like this movie because it talks about scientists who strunt the family's member. And there's a lot of interesting things that happens in the movie. OK, so what's my talk about today? So my talk today about is we're trying to look at what's happening over the 20 years, especially on the computing powers that we have. Now, if you look at the left one, 486 DX4, probably not many of you will know that. That was actually my first computer. So if you compare the specs of this computer 20 years ago, it was the best or probably the most powerful computers in town at that time, which is, I think, 1994. And not to mention that if you look at the specs right now, it's not even comparable to what we have nowadays with a small Android phone. And not to mention that it is very bulky. Think about that. The dimension is about 50 centimeters or 250 centimeters. But compared to our phone today, what we got is a pocket size. And for us, during the time in 1994, we have only those 6.22 together with Windows 3.11, which I think hardly got people here of that nowadays, unless you are a vintage user or you try to play around with all this retro computing, probably hardly. And for now, compared back to Android, what we have is Android is so powerful. It can run all the applications that we know. Anything like from Facebook, YouTube, for anything that you have. So compared to the size of what we have now and compared back 20 years back, the power, the computing power has changed so much that we can't even think of it and not to mention the size. However, there's a dilemma that we face nowadays with Android phones. Because Android phone is not just an Android phone. It is also a computer. And not to mention that it is also a tracker. So you have all sort of trackers on your phone. Be it to be your weather, be it to be a behavior, be it to be usage, or the app that you use, everything. Yes, it's a tracker by itself. And not to mention that, on average, you change your phones for every two years. So automatically, in some ways, your phones will get lag after two years. So how are we going to deal with the phones? Or in other words, how are we going to handle the phones after two years? Well, possibly what we're going to do that is we're going to throw away, not going to use it anymore. We'll just throw it away. Or maybe we'll just keep it in some darker corner. Like what we have, for my case, I have three phones in my drawer, which never been used, but still in quite good condition. Or perhaps some view might want to use it again, like use it for a GPS application. Let's say it weighs, you want to use it because you just simply don't want to throw the phones away. Or some of them might just give it to parents, like parents that might just want to use the old phone. But the key things that we are focusing on this thing over that is can we actually program an Android phone? As in program means we can write a simple program, like maybe a basic, or in this case, Python, or maybe Perl or Shell. Any simple programming language that we have on Android phone. However, sadly, what we have for the Android phone currently, the available programming language will be Java-based or calling, or not to mention that the latest one will be dark flutter or C sharp. So for me, I find that this is not quite cool. Reason for that is, to me, I find that Java or calling has quite a high learning curve for us. Imagine that when you try to build an app, you need to have quite a number of skills, ranging from building the interface, writing the back end in Java, and so forth. So it turns out to be quite a difficult way for us to enjoy the fun of the programming, like maybe we just want to run a small software or programs, like in Macy or Python on the phone. And not to mention that again, if you're trying to install an OSS other than Android, it will be very difficult. For example, think about that. If, let's say, you want to install OpenBSD or FreeBSD on an Android phone, I think that will be nearly impossible. Or not to mention that you try to install maybe Linux on it. It can be done, but it might be quite impossible or quite challenging to do so. So can we actually do a programming or maybe, let's say, Python on an Android phone? So these are the comments that I got when I talked to people about having a Python on an Android phone. The first would be, are you serious? Are you serious about that? Or second one would be, can you actually do that? And the third one, I got a comment actually from one of the guys when I visited Hong Kong that time and he mentioned that, well, you know, this is funny. We can't really, you know, if you can do that, that would be interesting for us to know. Okay, so this is kind of a comment that we got from that. Now, having spoken for so much, I haven't really introduced myself. My name is James and I'm the chair for PyCon Malaysia. And by the way, just to let you have a look at my t-shirt. We have a logo over there. This is my t-shirt for 2019. We have a t-shirt over there, okay? And I was the chair for PyCon Malaysia 2019. I was the co-chair for PyCon Malaysia 2018. And currently I'm working in an insurance company as a senior automation engineers. And the most important thing that I would like to bring on behalf of my chair for PyCon, we call it PyCon APAD 2020 chair is, we are going to launch a PyCon APAD 2020 online in September, so do check out our website. And not to mention that, Guido is also joining our conference as well. So do check out our website. So that that day will be from 13 to 16 September. So do check the updates from our website. Now let's get back to what we know about Python before we jump into Android. So for present state of Python, we know that Python actually can do a lot of things. So for example, we can actually build a simple script for system administration. And that was my background before that. We can also build a web app easily by Django or Flust or not to mention that we can write the backend as well using the Python as well. And of course, the most important thing is we can write a very simple interaction script on RPI Raspberry Pi through the GPIO pins that I mean for their libraries. So of course, you know that their libraries are written in Python. So it is very easy for us to interact with that. And this is why it makes the Raspberry Pi so popular among all the, you know, nearly all those who programs with Python. And of course, micro Python turn us also will one of the key focus for us to write a very simple programs for the embedded systems such as ESP32, ESP822, micro bit, you name it, and everything that can be written in micro Python. So we actually can do a lot of things with Python nowadays based on what we know. But in terms of having a Python on Android, we don't have much of the choice except from getting an app that runs with Python interpreter. By means when I say this Python interpreter, meaning that you had an app, you had an app that runs Python interpreter on it. It is not something that like Raspberry Pi where you have something that allows you to interact with the API, okay? Or in our words, interact with the sensors that you have for for example, gyroscope, for example, the accelerometer, other sensors like GPS, or perhaps let's say API that allows you to make a phone call, we hardly have that, okay? So probably there's one there over there which that will be the focus of my talk today which I'm going to show that how we actually can do that. Okay, so there is one thing, okay? So yes, the answers for that is we actually have the essence on that Python but sadly we don't have much of the application on that. So probably the question that you like to ask me on that is how actually can we do that? Or what kind of apps that allows us to do that? So the motivation I have to start with this project actually start from four years back where I'm actually quite boring during my Christmas week where I'm thinking of cataloging my book as you can see the books that I have right now at the back. So that was something that motivates me to do so. So when I look at my phone, my old phone as I mentioned before, I have few phones in my drawer, I like to think of, okay, is it possible to allow me to use that phone to build a barcode scanner to scan the ISBN barcode and then it allows me to insert my book into my DB or now with database, okay? That was something that I have in my thought. Is it possible for me to do so? Because a phone allows us to scan the barcode easily and not to mention that if you download the app you can simply just scan the barcode and it returns you some kind of an ISBN 39 number if you're a good lover. So this is my motivation, how am I gonna do that? So I begin to start my Google and then search and then I find that somebody did that before and the first line of the search actually interest me and draw a barcode scanner in six line of Python code. So I begins to wonder how actually can you do that? Okay, how actually can you do that? So what kind of app that you use from that? So I decided to visit the Digmore, okay? And I find that actually there's two kind of app at that time, 2016, where first app is called Android Scripting Environment and another one is a derivative of it is also you call that the variance of it is a scripting language for Android. Both actually, the first one actually is the first version of Google Project and then the other one if I remember wrongly is the second version of the or probably you and say it's an enhanced version of the Android Scripting Environment. So what makes me interested with this project is that based on what I searched for Wikipedia I found that actually it mentioned that this app allows us to access the script not access these sensors from the for the Android with a very simple script like Perl, like Shell script and of course in this case that will be Python. So this interests me. So I began to look at the code of this mark first and realize that the coding is very, very simple. So just six lines of code and then you scan it and it returns the ISBN and use the ISBN to look for the books from Google. So simple enough. So this allows us to build an app and together with my student at that time, Vincent Liu so we decided to come up with a script that allows us to scan a book, SPN number. And the script is named Snapbook because at that time Snapchat was quite popular. So we decided to come up with a very cool name called Snapchat. And the Snapchat is currently still running on still on my phone. And currently I'm still using Snapbook to snap my books for my collection. So this is the kind of thing. So if you want to know some personal story about the Snapbook, you can reach out to me in the channels and then I can share you more about this Snapbook story. Basically I still have the code for that. Okay, so after Snapbook, I find that a phone with so much sensors over that, it shouldn't be just used for only for barcode scanning since we are allowed to access so many sensors over that. So I decided to dig more further. Okay, I decided to look at more further. I'll say, oh, okay, what can we see? So first thing that interests me is because of the accelerometer. So I decided to go for that, write a simple script that allows me to get a accelerometer. So in this case, when I measure that, well, indeed it's kind of close to 9.81, which normally what we know is about the accelerations of the gravitational acceleration, sorry, 9.81 meter per second per second. So it's indeed very accurate in this case. So another question that pops out after I wrote the script is that I begin to wonder how Python's actually in that app allows me to assess the Android API. And of course another question is if we write down that accelerometer and measures the acceleration of the gravity, how accurate or how precise the return data from that API. So I begin to look at that when you look at that to the script that I have previously, okay, there's two files, or perhaps there are two modules that allows us to look at it, which is androidhelper.py and then android.py. So let's just look at the dissect of the Android helper. So for this class, let's focus one thing because there are a lot of things over there. So let's focus on one scan code method over there. So for this scan button method over there, that's why interesting line over there, return.rpc scan bar code. Okay, now this is interesting, return rpc, interesting. So I begin to look at another file, which is android.py. So I like to know where does this rpc comes from? So when I look at this in details, there's much more interesting information that I can look, I can find from here. First thing, it passes JSON data that we know over here to the socket, okay? This is one thing. So in other words, it means that actually for Python script to talk to the Android API is through the socket. That pass the JSON to the socket and there's another socket at the Android end that allows it to pass all the data in JSON form and then returns the API. So that's quite interesting. And of course on the Android end, this is very simple because in this case, when we send the JSON data over, it will just activate, or you can say initiate the intent for scan bar code. So from that, it will return the result that is scans from the bar code and it returns the data back to the channel. So as a conclusion, what we have with that is my Python script, let's say I write a Python script, I'll send this my request or my data, my method as a data in JSON form to Android helper as RPC and then through the Android. And once Android received the request in data in JSON format, and then it process to read the data from the sensor. Once it got the data from the sensor and then the same path, it goes back to the cycles and then this is how we got the data from the Python script. So what kind of APIs that we have with that? As I mentioned, we have SORI meter, JavaScript location, Wi-Fi, Bluetooth, SMS, phone call and you name it, okay? So there's interesting about here, which is there's two Python's app that I actually recommend from that. And the one that we have is QPython. QPython is very interesting and basically you get two versions that you can download. One is from the Google app store and the other one is from the GitHub website. And if you want to have a hacker version where you allows you to access all the Android API, I recommend you to download it from the GitHub. So you can just go to Google QPython three and then you can search for the GitHub from that. So pretty much you can get things from that, okay? So what can we do with QPython? In this case, since we mentioned that QPython is nearly the only app that I know that allows me to access the Android API. So for that QPython, it currently runs at the last one is 2.7 and 3.6. Of course, Snapple is based on 2.5 and 2.6 which is written earlier ago. Then the only things that probably we start from this QPython is simple, import Android app and that is how we start from that. And by the way, the Chinese word over here means is for larger, it means that for every mouse that you move, it always starts from the first step. So everything starts from the first step, import Android helper is the first step. Now the next slide that I'm going to show you over here is the traffic logger that I got from while I'm driving to my office. That was before the COVID time as I want to try out for my application from that. So this is how I drove all the way from this and each point, all this point are actually a point that I plot based on the data that I got from my phone. Okay, so this is how, so the way that I'm doing, I did that was I have my laptop together with me and start, have my laptop collecting the data for my phone and then process it and then I put it using a leaflet over here. So pretty much just how I do it. Okay, so right now I'm going to have a little bit of demo time. Okay, just allows me a little bit of time to show that and first thing, this is one thing that I'll show you from up, okay? Which is, thank you, okay? So, okay, just allows me to some problems, strange. Okay, nevermind, just give me a little time. Okay, that's interesting. Okay, nevermind, I'll show you another one. Okay, so this is my leaflet place. Okay, so right now this is my location which is near to my house, okay? So I'm going to get the location. So this is my house actually, previously my point and then right now I'm going to get the live GPS information for my phone. Okay, some problems with that. Not sure what's going on. Yep, okay, got it, okay? So this is right now the GPS location compared to the one that I have over here, okay? So if you can see, this is the real data that I got from that, from that. And you can also get the GPS as well as the locations. So if you look at that, this is point from the Q Python as well. So right now allows me to demonstrate with another one. So I hope this works. Yes, got it, good. Okay, so if you look at that, this one, I just need a little bit, smash it. So if you look at that right now, if I turn my phone, if I turn my phone around, okay? Well, of course my phone is not quite sensitive nowadays because I drop it so many times, okay? So if I rotate this guy over that, so this is kind of the real data or real time data that I got from the phone. So it will take according to what I move. Okay, I got to take that. Let's do it slowly, do it slowly again. So this is how I rotate and move around with this phone, okay? Yep, so this is how it works from that. Now, of course, I do not have the time for the SMS. So this is why I use another one, which is GPS to represent that, okay? So these are the reference. If you like to interested, you can look at more reference for the Q-Pyton and all the others are Android expert. With that, I'd like to ask questions and thank you for the talk for today. Thank you, James. Any questions from the floor? Any questions? So I forgot to mention that feel free to use the QMA setting on Zoom. So far, we don't have any questions. We still have four minutes to go. Okay, so yeah, so if that is the case then four minutes, I would like to use that to promote my event, Python, PyCon APEC online 2020. So as I mentioned before, you'll be on the 13th of September to 16th of September. So that is first thing. And currently it's online and we're going to start our ticket sales hopefully by next week. We still have some technicalities that to handle with. And for this time, this PyCon APEC 2020 is a little bit different compared to other PyCon. Reason for that is we have a lot of different varieties of the activities we did. So not to mention that we have the hackathon first thing, we have the hackathon, we have the tutorial and we do have a conference and we have panel discussion this time because we find that throughout the panel discussion, we can get different kind of people to come to speak to us and to exchange different ideas. So this is one thing that we try for this PyCon APEC online. And also one thing, same as EuroPython, we do invite, we do manage to invite Guido to come to us to speak to us, okay? So that will be a session. So we do have that end. Of course, we also managed to invite Keith Parker, if you know that, who's the creator of the snack, okay, we got him as well. And then we also got Audrey Rowe-Greenfield, who's also the author for the Two School of Jungle. So if you know her. And yeah, so these are the few figures that we got for our PyCon APEC online 2020 this time. So do join us. Ticket will start selling. And while current, the last update that I remember is the ticket is about five USD, okay? So things might change a little bit, but I'm not sure, hopefully it will still, yeah. So this is kind of my event for that, for the PyCon APEC 2020, yeah. So my time up in two minutes. All right, thanks James. There's still no questions. If there's any questions, go to the talk channel. Which is hashtag talk Python on Android. So far, I didn't see any questions at the moment. No, there are no questions. Yeah, there are some questions, demo effect. Okay, okay, oh, okay, so. No, it's not a question. So I'll move on to the next one. Thanks James. Thank you, thank you. Thank you, bye bye.