Using Google Maps in App Inventor 2
We are steadily getting some expertise in creating Android apps with App Inventor 2. If you have been following the series, then this is one more interesting app for you. For those who are just joining us, we recommend that you go through the previous issues of OSFY to gain expertise in creating your own apps.
Here’s yet another chapter in this series on mastering Android app development. This time, we will be using the inbuilt Google Maps feature of Android. Google Maps is the most reliable resource for commuters new to any area. Keeping that revolutionary feature in mind, let’s look at what to expect from the silent feature and how effective it is in making our lives simpler.
The idea behind the application
The idea behind the application revolves around the very common problem many of us face when we park our car in an unfamiliar area, and find it difficult to locate it later. So let’s make an Android application that will save the location of your car once you park it and later, you can trigger the app to show you the route from your current point to the car. So without much ado, let’s go ahead and look at what else we will need.
As we move ahead, we will discuss GUI requirements first because if we have these ready, then it is easy to assign or implement the behaviour of the application.
GUI requirements
For every application, there is a graphical user interface or GUI, which helps the user to interact with the on-screen components. How each component responds to user actions is defined in the block editor section.
As per our requirements, we will need the following components. 1. Activity starter: This is used to trigger various other processes outside our application. So in this case, since we will be launching the maps application from within our device, we will require it. 2. Label: Labels are the static text components used to display some headings or markings on the screen. 3. Button: This will let you trigger the event and is a very essential component. 4. Horizontal arrangement: This comprises special components, which keep all child components horizontally aligned. 5. TinyDB: We need to save the address in the database so that we can retrieve it later; hence, the TinyDB component will be helpful. It keeps the data persistently, which means it will keep the data even if you close the app and will be available when you start the app again. 6. Location sensor: This can provide you with your current geographical position. Google Maps uses latitude and longitude for navigation and, hence, it is used to fetch the GPS coordinates. The components that we will need for this application are listed in Table 1. Let’s drag them on to the designer from the left-hand side palette.