gpt4 book ai didi

firebase - 合并不同服务的 GoogleService-Info.plist 文件

转载 作者:行者123 更新时间:2023-12-02 17:21:16 27 4
gpt4 key购买 nike

我有一个大约 2 年前创建的应用程序。从一开始它就一直在使用谷歌分析。我现在想向其中添加 Firebase Cloud Messaging,但是当我从 firebase 控制台下载新的 GoogleService-Info 文件时,我注意到事情看起来非常不同。特别是,新文件不包含旧文件中的 TRACKING_ID。此外,GOOGLE_APP_ID 也不同。

这是我从developers.google.com下载文件时得到的结果:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>TRACKING_ID</key>
<string>UA-1234567-16</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>en.myapp.app</string>
<key>IS_ADS_ENABLED</key>
<false/>
<key>IS_ANALYTICS_ENABLED</key>
<true/>
<key>IS_APPINVITE_ENABLED</key>
<false/>
<key>IS_GCM_ENABLED</key>
<false/>
<key>IS_SIGNIN_ENABLED</key>
<false/>
<key>GOOGLE_APP_ID</key>
<string>1:123499115028:ios:12hvkyu2hv4uy</string>
<key>PROJECT_ID</key>
<string>myapp-ios</string>
</dict>

这是我从 firebase 控制台下载它时得到的结果:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AD_UNIT_ID_FOR_BANNER_TEST</key>
<string>ca-app-pub-397764742544/2931234567</string>
<key>AD_UNIT_ID_FOR_INTERSTITIAL_TEST</key>
<string>ca-app-pub-12345674546672544/4411234567</string>
<key>CLIENT_ID</key>
<string>347330439762-c9m21gcjytcvvbjkn76v85li9kro1tf013.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.123456739762-c9m21nf395l5n1nwedqedqg445tf013</string>
<key>API_KEY</key>
<string>AIzaSyD5_khkgkujbjhygoijhjS_6DPPLU0PW2izsJ8</string>
<key>GCM_SENDER_ID</key>
<string>6398755452786</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>en.myapp.app</string>
<key>PROJECT_ID</key>
<string>myapp</string>
<key>STORAGE_BUCKET</key>
<string>myapp.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<true/>
<key>IS_ANALYTICS_ENABLED</key>
<false/>
<key>IS_APPINVITE_ENABLED</key>
<false/>
<key>IS_GCM_ENABLED</key>
<true/>
<key>IS_SIGNIN_ENABLED</key>
<true/>
<key>GOOGLE_APP_ID</key>
<string>1:123430439762:ios:12hvkyu2hv4uy</string>
<key>DATABASE_URL</key>
<string>https://myapp.firebaseio.com</string>
</dict>
</plist>

如何创建允许我同时使用 FCM 和 Google Analytics(分析)的文件?

最佳答案

我们之前也遇到过类似的问题,当时我们一直使用 Google Analytics 进行跟踪分析,并使用 Firebase 作为数据库。

Firebase 并入 Google 产品后,我们联系了 Firebase support ,因为每个项目都有自己的配置文件,我们不确定如何在应用程序中单独配置这两个服务。

他们的回应是:

Using a separate project for FCM only is a supported use-case as long as the correct Sender Id is defined in the Client implementation it should work.

...

Important thing to remember for FCM setup is whichever project you choose to use please use the Sender ID and Server Key from the same project. 

当询问有关如何在 iOS 中设置客户端实现的更多详细信息时,我们被告知:

...you need to change the value for authorizedEntity at the FIRInstanceId class.

In terms of Android, you can extend the basic Messaging and IID services if you would like to implement custom logics for receiving or handling notifications.

这有助于回答您的问题吗?

如果您找不到相关文档,我还建议您联系 Firebase 支持人员。他们为我们与 Google 服务的合并提供了很大帮助。

关于firebase - 合并不同服务的 GoogleService-Info.plist 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43368390/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com