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.
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:
keytool -genkey -v -keystore release.keystore -alias [your_alias_name] -keyalg RSA -keysize 2048 -validity 10000
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
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.
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
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
rider folder of your android project.