0

Im developing a C++ Desktop application and trying to use Firebase Analytics using the Firebase C++ SDK from https://firebase.google.com/download/cpp

I tried initializing the analytics module but the application crashes.

Have added firebase_analytics.lib and included necessary header files.

#include <iostream>
#include "firebase/app.h"
#include "firebase/analytics.h"
#include "firebase/analytics/event_names.h"
#include "firebase/analytics/parameter_names.h"
#include "firebase/analytics//user_property_names.h"

int main()
{
    firebase::AppOptions appOptions;
    appOptions.set_api_key("project_api_key"); // pass the necessary details
    appOptions.set_app_id("app_id");
    appOptions.set_project_id("project_id");

    firebase::App* firebaseApp = firebase::App::Create(appOptions);
    firebase::analytics::Initialize(*firebaseApp);
    firebase::analytics::SetAnalyticsCollectionEnabled(true);
    delete firebaseApp;
}

The crash occurs on this line firebase::analytics::Initialize(*firebaseApp);

2
  • 1
    Are you sure that firebaseApp is a valid pointer? Commented Sep 4, 2024 at 8:05
  • Yes, it is a valid pointer Commented Sep 4, 2024 at 8:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.