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.
!!! important Firebase Auth won't work in Emulator, So always use real device for that purpose.

Create Project

Go to Firebase Console and Here you can create new projects. You will need 2. One For driver and one for rider. Do the following steps for both of them.

Enable Phone Authentication

After you log into Firebase choice firebase auth and enable Phone sign-in method.
Develop -> Authentication -> Setup Sign-In method -> Phone -> Enable -> Save

Get google-services.json

In each driver rider project page you will have to add one app with target of Android. With fingerprints put during wizard you can download the google-services.json that you need to put it in driver and rider folder of your android project.

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 one. One for Android applications and limited to their applicationId and another for your server app.
Server API key can be restricted to IP of server but Dashboard API key requires nginx and domain being set up so under context of this guide it is to be remained unrestricted. For production it would be better to install nginx and restrict the API key accordingly. This is 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 3.5.3+

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

This piece of information is to be entered at the file named Config.kt. Use search again and open it then replace the address with yours.

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 9mo ago