-
Notifications
You must be signed in to change notification settings - Fork 124
Update Analytics to use new options struct. #1745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jonsimantov
merged 4 commits into
analytics_windows_dll_updated
from
feat/desktop-analytics-init-options
Jun 25, 2025
Merged
Update Analytics to use new options struct. #1745
jonsimantov
merged 4 commits into
analytics_windows_dll_updated
from
feat/desktop-analytics-init-options
Jun 25, 2025
+69
−23
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This change updates the desktop analytics initialization to use the newly required Options struct for the Windows C API. - In `analytics/src/analytics_desktop.cc`: - `firebase::analytics::Initialize(const App& app)` now retrieves `app_id` and `package_name` from `app.options()`. - It calls `GoogleAnalytics_Options_Create()` to create the options struct. - Populates `app_id`, `package_name`, and sets a default for `analytics_collection_enabled_at_first_launch`. - Calls `GoogleAnalytics_Initialize()` with the populated options struct. - String lifetimes for `app_id` and `package_name` are handled by creating local `std::string` copies before passing their `c_str()` to the C API.
fcd9aaa
into
analytics_windows_dll_updated
10 of 12 checks passed
✅ Integration test succeeded!Requested by @jonsimantov on commit fcd9aaa |
jonsimantov
added a commit
that referenced
this pull request
Jun 25, 2025
… of Options struct. (#1744) * Update script and code to handle known hashes for multiple DLLs. * Fixed issues on Windows with multi-dll-hash code. * Fix: Link Crypt32.lib for firebase_analytics on Windows Add Crypt32.lib to the linked libraries for the firebase_analytics target on Windows. This resolves a linker error LNK2019 for _CryptBinaryToStringA@20, which was occurring in builds that included analytics_windows.obj (e.g., firebase_analytics_test). While CryptBinaryToStringA is not directly called in analytics_windows.cc, the linker indicates that analytics_windows.obj requires this symbol, possibly due to an indirect dependency or other build system interactions. Linking Crypt32.lib provides the necessary symbol. * Fix: Link Crypt32.lib for firebase_analytics_test on Windows I've added Crypt32.lib to the dependencies of the firebase_analytics_test target in `analytics/tests/CMakeLists.txt` when building on Windows. This is to resolve a persistent LNK2019 error for _CryptBinaryToStringA@20, which occurs during the linking phase of firebase_analytics_test.obj. This change directly links the required system library at the test executable level. * Update DLL. * Remove unused file. * Remove extra file. * Initialize Analytics C SDK with AppOptions on desktop This change updates the desktop analytics initialization to use the newly required Options struct for the Windows C API. - In `analytics/src/analytics_desktop.cc`: - `firebase::analytics::Initialize(const App& app)` now retrieves `app_id` and `package_name` from `app.options()`. - It calls `GoogleAnalytics_Options_Create()` to create the options struct. - Populates `app_id`, `package_name`, and sets a default for `analytics_collection_enabled_at_first_launch`. - Calls `GoogleAnalytics_Initialize()` with the populated options struct. - String lifetimes for `app_id` and `package_name` are handled by creating local `std::string` copies before passing their `c_str()` to the C API. * Update stub generation. * Format code. * Fix build issues. * Update Analytics to use new options struct. (#1745) * Initialize Analytics C SDK with AppOptions on desktop This change updates the desktop analytics initialization to use the newly required Options struct for the Windows C API. - In `analytics/src/analytics_desktop.cc`: - `firebase::analytics::Initialize(const App& app)` now retrieves `app_id` and `package_name` from `app.options()`. - It calls `GoogleAnalytics_Options_Create()` to create the options struct. - Populates `app_id`, `package_name`, and sets a default for `analytics_collection_enabled_at_first_launch`. - Calls `GoogleAnalytics_Initialize()` with the populated options struct. - String lifetimes for `app_id` and `package_name` are handled by creating local `std::string` copies before passing their `c_str()` to the C API. * Format code. * Fix build issues. --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Format code. * Only display Analytics warnings if we are not in stub mode. * Format code. * Address review comments and add missing copyright notices. * Remove extraneous commented out code. * Add another known hash to the list. --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Testing
Type of Change
Place an
x
the applicable box:Notes
Release Notes
section ofrelease_build_files/readme.md
.