Skip to content

System Setup

baltasarb edited this page Jul 27, 2019 · 4 revisions

Table of Contents

Database Management System

The chosen DBMS was PostgreSQL due to the possibility of distance and route calculations provided by the geography library included in it.

Installation

  • The chosen installation was the certified by EnterpriseDB and can be found here.

  • Once the installation completes, the following components should be installed using the Stack Builder:

    • Database Drivers:
      • pgJDBC v42.2.2-1
    • Spatial Extensions:
      • PostGIS 2.5 Bundle for PostgreSQL 11 (64 bit) v2.5.1
  • Launch the application pgAdmin to use PostgreSQL.

pgAdmin

Create a database

  • Object (navigation bar)
  • Create
  • Database
  • Save

Create Script

  • Right click the database or the schema and click Create Script. This is used on database creation.

Create a Query

  • Right click the database or schema and left click Query Tool.
  • To save a query insert the name of the file in the path after the path is decided.
  • Every file must have the extension .sql.

Service

The technologies used in the service of the system structure are: * Java Spring * JPA (Java Persistent Application)

To create a project with this configuration go the Spring Initializr site and as dependencies add each one the components (JPA, H, Web).

  • Build: Gradle.
  • Language: Kotlin.
  • Spring Boot: 2.1.3.
  • Group: ps.g49.
  • Artifact: social-routing-service.
  • Name: social-routing-service.
  • Description: Social Routing Service.
  • Package Name: ps.49.socialroutingservice.
  • Packaging: Jar.
  • Java Version: 8.

Client Application

Is needed to follow some configurations in development project when using the Maps SDK for Android in Android Apps.

Procedures:

  • Download Android Studio.
  • The Google Play services SDK Installation.
  • Get a Google Maps API key.

Download Android Studio

Follow the guides to download and install Android Studio.

Set Up Google Play Services

To develop an app using the Google Play services APIs, is necessary set up the project with the Google Play services SDK, which is available from the Google maven repository. To test apps when using the Google Play services SDK, must be used either:

  • A compatible Android device that runs Android 4.1 or higher and includes Google Play Store.
  • The Android emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or higher.

To make the Google Play services APIs available to an app:

  • Open the build.gradle file inside the application module directory.
  • Add a new build rule under dependencies for the latest version of play-services, using one of the APIs listed.
  • Ensure that a top-level build.gradle contains a reference to the google() repo or to maven { url "https://maven.google.com" }.
  • Save the changes, and click Sync Project with Gradle Files in the toolbar.

Ensure Devices have the Google Play services APK

Because each app uses Google Play services differently, it's up to you decide the appropriate place in your app to verify the Google Play services version. For example, if Google Play services is required for your app at all times, you might want to do it when your app first launches. On the other hand, if Google Play services is an optional part of your app, you can check the version only once the user navigates to that portion of your app.

Another approach is to use the isGooglePlayServicesAvailable() method. You get a reference to the singleton object that provides this method using GoogleApiAvailability.getInstance(). You might call this method in the onResume() method of the main activity. If the result code is SUCCESS, then the Google Play services APK is up-to-date and you can continue to make a connection. If, however, the result code is SERVICE_MISSING, SERVICE_VERSION_UPDATE_REQUIRED, or SERVICE_DISABLED, then the user needs to install an update. In this case, call the getErrorDialog() method and pass it the result error code. The method returns a Dialog you should show, which provides an appropriate message about the error and provides an action that takes the user to Google Play Store to install the update.

Get a Google Maps API Key

The application needs an API key to access the Google Maps servers. The type of key needed is an API key with restriction for Android apps. The key is free. You can use it with any applications that call the Maps SDK for Android, and it supports an unlimited number of users.

Choose one of the following ways to get your API key from Android Studio:

  • The fast, easy way: Use the link provided in the google_maps_api.xml file that Android Studio created for you:
    1. Copy the link provided in the google_maps_api.xml file and paste it into your browser. The link takes you to the Google Cloud Platform Console and supplies the required information to the Google Cloud Platform Console via URL parameters, thus reducing the manual input required from you.
    2. Follow the instructions to create a new project on the Google Cloud Platform Console or select an existing project.
    3. Create an Android-restricted API Key to project.
    4. Copy the resulting API key, go back to Android Studio, and paste the API key into the <string> element in the google_maps_api.xml file.
  • A slightly less fast way: Use the credentials provided in the google_maps_api.xml file that Android Studio created for you:
    1. Copy the credentials provided in the google_maps_api.xml file.
    2. Go to the Google Cloud Platform Console in your browser.
    3. Use the copied credentials to add the app to an existing API key or to create a new API key.
  • The full process for getting an API key: If neither of the above options works for your situation, follow the complete process.

Addition of API Key to app

Steps to include the API Key in application's manifest, contained in the file AndroidManifest.xml.

  1. In AndroidManifest.xml, add the following element as a child of the <application> element, by inserting it just before the closing </application> tag:
<meta-data
    android:name="com.google.android.geo.API_KEY"
    android:value="YOUR_API_KEY"/>
  1. Save AndroidManifest.xml and re-build the application.

Connection to the network

In order to perform network operations in your application, your manifest must include the following permissions:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />