The purpose of this App is to show a list of some restaurants from Córdoba and Pacov where we can find special diets food (such as
vegetarian, gluten free, Mediterranean, Halal, low calorie...) and assign them a rating, which will be shared by all the users of it.
This list is organized by categories
For this, we will have five screens:
- Screen 1 (main one). Here we select the category according to the type of food, and the language.
- In this screen we select a restaurant. For this, the restaurants' banners of the selected category are shown, and also the average rating given by the users, which will be obtained from a Fusion Table from Google (Dynamic table) found in Google drive.
- Here information from the selected restaurant is shown. Apart from the banner, the rating and the number of evaluations given, there is also a menu from the restaurant. We can call to make a reservation, get further information on the Website of our Project, Smart Wellness, see where the restaurant is located in Google maps and have access to the screen Rating.
- By using some sliders we can rate different aspects from the establishment (food, service, atmosphere...). The average score is shown at the bottom and can be sent to the referred Fusion Table.
The data from the App is saved in three different ways according to the access that we wish to have to it:
- Variables. The information is only available on the correspondent screen, but it can be translated to another one when it is called.
- TinyBD. The information is saved locally (on the mobile phone) in a database and it is available for all the screens.
- Fusiontable. The information is collected on an external database or dynamic table in Drive and it is available for all the users of the application.
In order to use the different services offered by Google for free (Drive, Fusion table, etc.) it is necessary to obtain a "gmail" email account.
Subsequently, we will need to connect the "Google Dynamic Tables" (Fusion table) application with our "Drive" storage unit.
Fusion Tables are in the table format and allow us to access and manage their content from other applications through an API (Application Programming Interface).
App Inventor uses the Fusion Table API v.2.0. The application that uses this component must be authenticated on Google servers. For this we will use a special service e-mail account that together with a credential (extension file ".p12") will allow loading and reading the secret key that authenticates all access.
Let's see in detail how to perform this process
CONECTING GOOGLE DRIVE TO FUSIONTABLE
At this point, we're supposed to have a Google email account.
In order to use the Fusion Table application, we must connect it to our Google Drive.
The steps to follow are these:
- Enter Drive and click on My Drive / More / Connect more applications
2. We select Google Fusion Table
3. We click on connect
4. A window will appear indicating that the application are already connected
5. We can check that the application is already available
CREATION OF THE FUSIONTABLE "GLUTEN FREE"
We are going to create a simple dynamic table that we will use later in an application example with App Inventor.
By clicking on "Dynamic tables of Google" (previous image), a window will appear as shown in the image below.
Select "Create empty table" and click "Next". An empty table with the name "New Table" will appear.
By clicking on "New Table" we change the name to "Gluten Free". In "Description" we add "Resturant's ratings"
To finish we click on "Save"
We will now change the name of the columns "Text" and "Number" to "Restaurant" and "Rating", respectively.
For this we proceed as follows:
When you place the cursor over the name of the "Text" column, a triangle appears and, clicking on it, a menu of options is displayed.
Select the option "Change ..." and change the name to "Restaurant" and indicate that the data type is "Number" and the Format "1235".
Similarly, we change the name of the column "Number" to "Rating" by selecting, in this case, the Format "1234.56".
After entering some values and hiding the "Location" and "Date" columns, the aspect should be as follows
CREATING A SERVICE ACCOUNT AND CREDENTIALS
As indicated above, in order to use the Fusiontable component in App Inventor and access a Fusion Table ("Gluten Free", for example) it is necessary to authenticate the access in the Google servers.
For this, it is necessary to register with the "Google Cloud Platform" for the management of identities and access to cloud resources, enable the Fusion Table API and create an authorization credential that contains identification and a private access key. It is also necessary to obtain a special email account called "service account" that will be associated with the credential (this operation is done automatically when creating the credential). The credential will be downloaded to our computer as a file with the format ".p12".
Step 1. Access to "Google Cloud Platform" and creation of a project
We enter https://cloud.google.com/iam/ and click on Console
In the welcome window we accept the conditions of service and continue
Now we must create a Project to which we will link the authorization credential. To do this, we click on Select a Project
Next we create a new Project by clicking on "+"
A name will be assigned