firebase / quickstart-cpp

Firebase Quickstart Samples for C++
https://firebase.google.com/games
Apache License 2.0
212 stars 123 forks source link

firebase c++ sdk on android firebase::app::create with AppOption return NULL #28

Closed chanhbc closed 5 years ago

chanhbc commented 6 years ago

I create sdk firebase c++ on Android, I use the google_service.json configuration file when everything is fine, but when I use :: firebase :: AppOption to configure then it returns NULL, please tell me I made a mistake where, thanks you so much

::firebase::App *app;
::firebase::AppOptions appOptions;
appOptions = firebase::AppOptions();

const char *api_key = "";
const char *app_id = "";
const char *database_url = "";
const char *messaging_sender_id = "";
const char *project_id = "";
const char *storage_bucket = "";
appOptions.set_api_key(api_key);
appOptions.set_app_id(app_id);
appOptions.set_database_url(database_url);
appOptions.set_messaging_sender_id(messaging_sender_id);
appOptions.set_project_id(project_id);
appOptions.set_storage_bucket(storage_bucket);

app = ::firebase::App::Create(appOptions, app_id, jni_env, activity); // result NULL
a-maurice commented 6 years ago

Hi there, sorry for the delay in getting back to you.

Just to clarify, are you passing in the correct fields from the Firebase console for all of those empty strings? I've only been able to reproduce this by having incorrect values for those. You can either get those fields from the Firebase console, or by looking at the google_services.json file, which will also have them included.

stewartmiles commented 5 years ago

@chanhbc since we haven't heard from you we'll assume you've resolved your issue. If you still have a problem please respond with more information.