/QtFirebaseExample

Example Qt app for the QtFirebase project

Primary LanguageQMLMIT LicenseMIT

QtFirebaseExample

Example Qt app for the QtFirebase project

Quick start

  1. Clone the example app and the QtFirebase project
  • Clone example project

    cd /path/to/projects
    git clone git@github.com:Larpon/QtFirebaseExample.git
    
  • Clone the QtFirebase project

    Clone into the "extensions" folder or into other folder of your choice

    cd /path/to/projects/QtFirebaseExample/extensions
    git clone git@github.com:Larpon/QtFirebase.git
    
  1. Download and unzip the latest 2.x Firebase C++ SDK from Google.
cd /path/to/download
wget https://dl.google.com/firebase/sdk/cpp/firebase_cpp_sdk_2.1.2.zip
unzip firebase_cpp_sdk_2.1.2.zip -d /path/to/sdk
  1. Add symlink OR set QTFIREBASE_SDK_PATH variable

If you have multiple projects using QtFirebase it's a space-saver to have the Firebase C++ SDK (~832 MB) in one place.

So you can either symlink the Firebase C++ SDK to the default search path OR set the QTFIREBASE_SDK_PATH variable to the absolute path of the SDK in the .pro file for the app build.

  • Symlink

    ln -s /path/to/sdk/firebase_cpp_sdk /path/to/projects/QtFirebaseExample/extensions/QtFirebase/firebase_cpp_sdk
    
  • QTFIREBASE_SDK_PATH variable

    Open the example project with QtCreator /path/to/projects/QtFirebaseExample/QtFirebaseExample.pro Navigate to the App.pro (sub)project file in the Project pane

    QtFirebaseExample
    |_...
    |_App
        |_App.pro
    

    Locate the lines:

    # NOTE QTFIREBASE_SDK_PATH can be symlinked to match $$PWD/firebase_cpp_sdk
    QTFIREBASE_CONFIG += analytics admob
    # include QtFirebase
    include(../extensions/QtFirebase/qtfirebase.pri)
    

    Change it to match your path(s)

    QTFIREBASE_SDK_PATH = /path/to/sdk/firebase_cpp_sdk
    QTFIREBASE_CONFIG += analytics admob
    # include QtFirebase
    include(../extensions/QtFirebase/qtfirebase.pri) # <- /path/to/QtFirebase/qtfirebase.pri
    
  1. Almost done

Android notes

The project needs gradle and the Android NDK (r10d +) to build on Android.

  • Enable gradle in your Project build options in QtCreator.
  • Edit path in /path/to/projects/QtFirebaseExample/extensions/QtFirebase/src/android/gradle.properties
  • Edit path in /path/to/projects/QtFirebaseExample/extensions/QtFirebase/src/android/local.properties

iOS Notes

The project uses CocoaPods to build on iOS.

# cd /path/to/QtFirebase/src/ios/CocoaPods
# From our example:
cd /path/to/projects/QtFirebaseExample/extensions/QtFirebase/src/ios/CocoaPods
pod install
  1. Push the Run button

If you build for Android or iOS you should see output like the following in the "General Messages" tab of QtCreator

Project MESSAGE: QtFirebase: configuring build for supported Firebase target platform...
Project MESSAGE: No QTFIREBASE_SDK_PATH path sat. Using default (firebase_cpp_sdk) /path/to/projects/QtFirebaseExample/extensions/QtFirebase/firebase_cpp_sdk
Project MESSAGE: QtFirebase Android base
Project MESSAGE: QtFirebase including Analytics
Project MESSAGE: QtFirebase including AdMob
Project MESSAGE: This project is using private headers and will therefore be tied to this specific Qt module build version.
Project MESSAGE: Running this project against other versions of the Qt modules may crash at any arbitrary point.
Project MESSAGE: This is not a bug, but a result of using Qt internals. You have been warned!

If you are building for Desktop target the output should be something like this:

Project MESSAGE: QtFirebase: configuring build for non-supported Firebase target platform...