Implement Firebase inside of a Library(在库中实现 Firebase)
问题描述
我想在我想在许多应用程序中用作 SDK 的库中实现 Friebase 通知系统.
I want to implement Friebase notifications system inside a library that I want to use as SDK in many apps.
Firebase 现在要求提供应用 ID,但我在库中实现它,因此没有应用 ID.
Firebase is asking now for an App ID, but I'm implementing it inside a library thus no App Id.
如何实现向使用我的库的应用发送通知的目标?
How could I achieve my goal to be able to send notifications to my apps that use my library ?
提前致谢.
推荐答案
是的,您实际上可以这样做,在您的库中 build.gradle 将其放在 defaultConfig 字段中
Yes you can actually do this, on your library build.gradle put this inside the defaultConfig field
buildConfigField("String", "FIREBASE_APP_KEY", ""${firebaseAppKey}"")
然后在你项目的 gradle.properties
firebaseAppKey = <yourFirebaseAppSecret>;
对于 每个 项目/应用,您必须在 gradle.properties 上定义此变量.
For each project/app you must define this variable on your gradle.properties.
您必须为每个项目创建一个 Firebase 应用,但您的库现在可以拥有 Firebase SDK.
You'll have to create a firebase app for each project, but your library can now have the Firebase SDK.
当您想访问此环境变量值时,请使用 BuildConfig.FIREBASE_APP_KEY(例如,实例化 firebase).
When you want to access this environment variable value use BuildConfig.FIREBASE_APP_KEY
(e.g. instantiate firebase).
这篇关于在库中实现 Firebase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在库中实现 Firebase
- URL编码Swift iOS 2022-01-01
- Xcode 7.3 中带有 UILabel 的 UIStackView 2022-01-01
- 在 Iphone SDK 的导航栏上添加多个按钮 2022-01-01
- 网上有没有好的 UIScrollView 教程? 2022-01-01
- GPS状态的广播接收器? 2022-01-01
- SetOnItemSelectedListener上的微调程序错误 2022-01-01
- 类似于 Mail.app 的 iPad 模态视图控制器? 2022-01-01
- UITextView 内容插图 2022-01-01
- 使用自动布局向 UIScrollView 添加动态大小的视图 2022-01-01
- 如何在 iPhone 模拟器中重置 NSUserDefaults 数据? 2022-01-01
