Firebase消息传递不活动,与AppMeasurementService断开连接

Sin*_*nko 7 android firebase firebase-cloud-messaging

我试图使用FCM消息将通知发送到Android模拟器设备中,但我没有收到任何通知。google app ID与google-services.json中的相同

这是我从控制台得到的:

D / FA:已连接到远程服务

V / FA:处理排队的服务任务:1

V / FA:不活动,正在与AppMeasurementService断开连接

我的build.gradle(Module:app):

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    defaultConfig {
        applicationId "com.example.cris.firebasenotificationexam"
        minSdkVersion 22
        targetSdkVersion 23
Run Code Online (Sandbox Code Playgroud)

....

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    apply plugin: 'com.google.gms.google-services'
    compile 'com.google.firebase:firebase-messaging:9.0.2'
}
Run Code Online (Sandbox Code Playgroud)

有人知道如何解决此问题吗?

Bob*_*der 0

日志消息:不活动、与 AppMeasurementService 断开连接是正常现象,并不表示存在问题。

编辑文件的依赖项块build.gradle

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.google.firebase:firebase-messaging:9.0.2'
}

// Moved the following statement.  Was in the dependencies block
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)

更多详细信息,请参阅Firebase 设置指南

另外,请考虑使用最新发布的库版本:firebase-messaging 为 9.8.0,appcompat-v7 为 25.0.1。