Android

Firebase Auth

Firebase phone authentication has been used for driver and rider's SMS authenticatioin proccess. It free and has been localized for many countries and languages.

SHA-1 fingerprint

Each apk you generate needs to be signed by a keystore wheter you generate a debug or a release apk. Many API providers encourage you or even make you to have your APK's keystore fingerprint added on their API console so only you and your APK would be able to use that API's resources. With that explanation let's get SHA-1 fingerprint of debug and release keystore and add them on Firebase console because it's mandatory for Firebase Authentication to work too (Optional but recomended for Google Maps too).

Generate Release keystore

If you don't have a release keystore already or don't know how to generate one you can do that in this section. To create a keystore open terminal panel in Android studio and enter following command:
1
keytool -genkey -v -keystore release.keystore -alias [your_alias_name] -keyalg RSA -keysize 2048 -validity 10000
Copied!
Don't forget to replace [your_alias_name] with an alias name of your choice, like releasekey. after entering this command you will be taken through some questions that you need to fill and will work as signature of your release APKs. after that you will need to enter your release key's passwords and alias in file gradle.properties so generation of SHA-1 key and APK's would be done automatically from now on.

Get SHA-1 key

If you have done the previous step correctly this should be pretty easy. Open Gradle panel in Android studio. Then open node of Tasks->android->signingReport. Runing signingReport will show a report on Run panel that has SHA-1 key for both release key and debug key. Now have this SHA-1 keys copied somewhere because you will need it during applying for Firebase Authentication.
Firebase Auth won't work in Emulator, So always use real device for that purpose.

Enable Phone Authentication

On the firebase project used on the server side installation enabled the "Phone Authentication"

Create Applications

Create 2 Android Apps for driver and rider and assign an application id you will use later for the apps to them.

Get google-services.json

Use download json button and retrieve the file. Put it in the place on both driver and rider project as firebase instructs you. You will need to only copy this file the rest is already done.

Google Maps

Google Maps has been used for some of application functionalities. you will need to retrieve an API key from Google to have the app working.

Maps console

Go to Google Maps Developers Console and select taxi project which was created in previous section.
Having Billing enabled on your Google Account is mandatory for some API's to work. So make sure you have the Billing enabled or there might be some parts don't work as expected.

Enabling APIs

You need to have these APIs enabled in library section one by one:
  • Maps SDK for Android
  • Maps Static API
  • Places API
  • Distance Matrix API
  • Geocoding API
  • Maps JavaScript API

Getting API key

Now go to Credentials section and create a new API key. In next section you will see where you need to paste this key.
Server API key can be restricted to IP of server but Dashboard API key requires nginx and domain being set up. For the purpose of installation it is to be remained unrestricted. For production it would be secure to install nginx and restrict the API key accordingly. This is common knowledge and not covered in this documentation.

Configuration

You are almost finished and ready to compile your apps. but first let's go to client apps customization file and fill some parameters there. Open android folder in Android Studio 2021.1+

Google Maps API Key

In common project you have this file named options.xml. open the file which will look like this, In the higlighted line you will require to enter Google Maps API key starting with AIza. This API key will require to have Android Maps SDK, Places SDK & Geocoding enabled from Library.
1
<resources>
2
<string name="email" translatable="false"></string>
3
<string name="website" translatable="false"></string>
4
<string name="twitter" translatable="false"></string>
5
<string name="instagram" translatable="false"></string>
6
<string name="facebook" translatable="false"></string>
7
<string name="playStore" translatable="false"></string>
8
<string name="fabric_key" templateMergeStrategy="preserve" translatable="false"></string>
9
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false"></string>
10
<string name="defaultLocation" translatable="false"></string>
11
<string name="default_language">en_US</string>
12
<bool name="singlePointMode">true</bool>
13
<integer name="maximumDestinations">5</integer>
14
<bool name="request_payment_enabled">true</bool>
15
<integer name="minimum_payment_request">10</integer>
16
<integer name="charge_first">10</integer>
17
<integer name="charge_second">20</integer>
18
<integer name="charge_third">50</integer>
19
<integer name="minimum_points">2</integer>
20
<integer name="maximum_points">2</integer>
21
<bool name="use_miles">false</bool>
22
</resources>
Copied!

Server Address

In order to connect driver and rider app to your server open the file named Config.kt and replace the IP address of server to your server's IP. Keep in mind ports of rider and driver app are different and they should remain same as they are now.

ApplicationId

In previous sections you have selected an applicationId. now change the default applicationId to the one you have selected in each project's build.gradle file.
Last modified 1mo ago