Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dora4/dora-firebase-support
🧩 Dora MVVM框架扩展包 - 用于整合Firebase产品增长运营框架
https://github.com/dora4/dora-firebase-support
Last synced: about 2 months ago
JSON representation
🧩 Dora MVVM框架扩展包 - 用于整合Firebase产品增长运营框架
- Host: GitHub
- URL: https://github.com/dora4/dora-firebase-support
- Owner: dora4
- License: apache-2.0
- Created: 2023-09-14T00:58:08.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-12-14T17:25:34.000Z (about 2 months ago)
- Last Synced: 2024-12-14T18:28:53.183Z (about 2 months ago)
- Language: Kotlin
- Homepage:
- Size: 134 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
dora-firebase-support
![Release](https://jitpack.io/v/dora4/dora-firebase-support.svg)
--------------------------------#### gradle依赖配置
添加以下代码到项目根目录下的settings.gradle.kts
```kotlin
pluginManagement {
resolutionStrategy {
eachPlugin {
if (requested.id.namespace == "com.google.firebase") {
useModule("com.google.firebase:firebase-crashlytics-gradle:2.9.2")
}
}
}
}
dependencyResolutionManagement { {
repositories {
maven { setUrl("https://jitpack.io") }
}
}
```
添加以下代码到项目根目录下的build.gradle.kts
```kotlin
plugins {
id("com.google.gms.google-services") version("4.3.15") apply(false)
id("com.google.firebase.firebase-perf") version("1.4.2") apply(false)
}
```
添加以下代码到app模块的build.gradle.kts
```kotlin
dependencies {
// 扩展包必须在有主框架dora的情况下使用
implementation("com.github.dora4:dora:1.2.33")
implementation("com.github.dora4:dora-firebase-support:1.13")
}
```在app模块加入google-services.json并在其build.gradle.kts加入以下代码。
```kotlin
plugins {
id("com.google.gms.google-services")
id("com.google.firebase.crashlytics")
id("com.google.firebase.firebase-perf")
}
```
#### 使用方式在AndroidManifest中加入配置。
```xml
```
使用SpmUtils的工具方法埋点统计,使用activity和fragment以spm开头的扩展函数也可以。
```kotlin
spmSelectContent("查看官方公告详情") // 通用行为统计
spmLogin("google") // 谷歌登录
spmSignUp("huawei") // 华为应用市场渠道包注册
spmPurchase(currency = "USD", value = 1.0) // 衡量购买收入,用户成功支付了1USD
spmAdImpression(platformName = "", impressionData = null) // 衡量广告收入
```添加以下代码检测性能。
```kotlin
// Import these Performance Monitoring classes at the top of your `.kt` file
import com.google.firebase.perf.FirebasePerformance
import com.google.firebase.perf.metrics.AddTrace// Add the `@AddTrace` annotation above the method you want to trace
// the `enabled` argument is optional and defaults to true
@AddTrace(name = "onCreateTrace", enabled = true)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
```