Android集成FireBase

1.进入官网

https://console.firebase.google.com/

登录后进入控制台

2.点击-添加项目

3.输入项目名称

 

4.点击-继续

5.选择账号 创建项目

6.等待项目创建

 

 7.点击继续--然后点击android图标

8.输入包名-点击注册应用

 9.下载google-service.json文件  然后点击下一步

 10.添加SDK  然后点击下一步

 

Gradle 的 Google 服务插件会加载您刚刚下载的 google-services.json 文件。请修改您的 build.gradle 文件以使用该插件。

项目级 build.gradle(<项目>/build.gradle):

buildscript {
  repositories {
    // Check that you have the following line (if not, add it):
    google()  // Google's Maven repository
  }
  dependencies {
    ...
    // Add this line
    classpath 'com.google.gms:google-services:4.3.8'
  }
}

allprojects {
  ...
  repositories {
    // Check that you have the following line (if not, add it):
    google()  // Google's Maven repository
    ...
  }
}

 应用级 build.gradle(<项目>/<应用模块>/build.gradle):

apply plugin: 'com.android.application'
// Add this line
apply plugin: 'com.google.gms.google-services'

dependencies {
  // Import the Firebase BoM
  implementation platform('com.google.firebase:firebase-bom:28.2.1')

  // Add the dependency for the Firebase SDK for Google Analytics
  // When using the BoM, don't specify versions in Firebase dependencies
  implementation 'com.google.firebase:firebase-analytics'

  // Add the dependencies for any other desired Firebase products
  // https://firebase.google.com/docs/android/setup#available-libraries
}

 11.点击前往控制台

 如图: 点击箭头所示图标

 12.进入后会展示如下:

 

 至此,项目创建完成  

 附上地址链接:

文档地址https://firebase.google.com/docs/ab-testing/?authuser=0

 设置android客户端文档:

https://firebase.google.com/docs/cloud-messaging/android/client?authuser=0

具体使用请参考文档地址: 

https://firebase.google.com/docs/cloud-messaging/android/client?authuser=0

 对了  之前下载的google-service.json 到时候放在项目目录下

另附上FCM功能github地址:

https://github.com/firebase/quickstart-android/tree/cdf2619efe945f2b3d2536c805fbb71636adc96f/messaging/app/src/main/java/com/google/firebase/quickstart/fcm/java

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值