Push 功能接入 - sunitsdk/SUnitDemo GitHub Wiki
SDK 2.2.0.0 版本 支持了Firebase的push模块, 如需启用, 需要CP配合引入 Firebase 模块.
Push SDK 可以用来推送消息, 提升用户活跃等
一. 需要由运营提供 Firebase Android 配置文件 (google-services.json)
a. Android 应用将配置文件移动到应用的模块(应用级)目录中( 和build.gradle 同级别)
b. 打开 Unity 项目的 Project 窗口,然后将您的配置文件移到 Assets 文件夹中
二. 如需在应用中启用 Firebase 产品,请将 Google 服务插件添加到 Gradle 文件中。
- 在根级(项目级)Gradle 文件 (build.gradle) 中添加规则,以纳入 Google 服务 Gradle 插件。此外,请确认您拥有 Google 的 Maven 代码库。
buildscript {
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
}
dependencies {
// ...
// Add the following line:
classpath 'com.google.gms:google-services:4.3.3' // Google Services plugin
}
}
allprojects {
// ...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
// ...
}
}
- 在您的模块(应用级)Gradle 文件(通常是 app/build.gradle)中,应用 Google 服务 Gradle 插件:
apply plugin: 'com.android.application'
// Add the following line:
apply plugin: 'com.google.gms.google-services' // Google Services plugin
android {
// ...
}