Google Firebase Console Setup Android & iOS
1. First of all, we will have to create an application on the Google Firebase Console. You can access it here.
Enable Google Authentication
After creating your project, go to the Authentication section in the left hamburger menu of the Firebase Console, and press Select Sign In Method.
In the Sign-in provides options, select and enable Google.
After creating your project and enabling Google Sign In on the Google Firebase Console, we will need a configuration file for our application, you can generate the file from your project settings section (press the settings knob).
2. Select the platform you wish to generate the configuration file for, in this case we will select Android.
3. After selecting Android, we will need to fill out the form with the information of our App, to enable Google Sign-In, and to do so we will need to provide Google with the package name, the name of the App and a SHA-1 certificate.
For our example application we will use a debug key, but to publish your app to the store, you will need a different SHA-1 key. You can read more about it here.
For the SHA-1 debug key you will need to modify the command bellow, open a CMD or Terminal and paste the bash:
Mac: keytool -list -v -keystore /Users/[USERNAME]/.local/share/Xamarin/Mono\ for\ Android/debug.keystore -alias androiddebugkey -storepass android -keypass android Windows: keytool -list -v -keystore "C:\Users\[USERNAME]\AppData\Local\Xamarin\Mono for Android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
4. Finally, you will be able to download the google-services.json file and add it to your Xamarin.Android project.
PDT: If you replace the google-servies.json file on the sample project and change the Xamarin.Android package name of the project to yours, the android sample project should work.
We will also need to create a configuration file for iOS, which you can get in the settings section of you're project in Firebase Console, the steps are very similar to the one we just did for android, you will select the Application name we initially created and your application bundle id. This time there will be no need to add SHA-1 certificate, so go ahead and enable the Google Sign-In option.
Fill out the form with the required information and register the App.
- Download the GoogleService-info.plist file and add it to your Xamarin.iOS project, Important: you must set the Build Action of this file as a BundleResource so the Plugin can find it as part of the app bundle at runtime.
Note: To be able to run the iOS project on the simulator, you will have to enable Keychain sharing on the Entitlements.plist:
Key chain sharing on iOS, need entitlements and for that we need a valid provision profile, find out more about it here.
<= Back to Table of Contents