首页 > 解决方案 > firebase 通知未显示,令牌未刷新

问题描述

当我添加这个捆绑的依赖项时, 'com.google.android.gms:play-services:12.0.1' , (FirebaseInstanceIdService,FirebaseMessagingService) 这两个类没有响应。

我尝试过的解决方案:

  1. 添加 firebase 消息传递依赖项。

  2. 在示例应用程序中使用我的应用程序的 google-services.json 并且通知工作正常..

    <service android:name="com.Bookerr.android.services.MyFirebaseMessagingService"
            android:permission="true">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT"/>
            </intent-filter>
        </service>
        <service android:name="com.Bookerr.android.services.MyFirebaseInstanceIDService"
            android:permission="true">
            <intent-filter>
                <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
            </intent-filter>
        </service>
        
        // this is my GRADLE FILE 
        
        apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.Bookerr.android"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }
    }

    /*compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }*/
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.ss.bannerslider:bannerslider:1.8.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'uk.co.chrisjenx:calligraphy:2.2.0'
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.squareup.retrofit:retrofit:1.9.0'
    implementation 'com.squareup.okhttp:okhttp:2.7.5'
    implementation 'com.squareup:otto:1.3.8'
    implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
    implementation 'com.stripe:stripe-android:6.1.2'
    implementation 'com.stripe:stripe-java:5.33.2'
    implementation 'com.stripe:stripe-android-pay:4.1.3'
    implementation 'io.branch.sdk.android:library:2.19.5'
    implementation 'com.android.volley:volley:1.1.1'
    implementation 'com.github.sundeepk:compact-calendar-view:2.0.2.3'
    implementation 'com.koushikdutta.ion:ion:2.2.1'

//    implementation 'com.google.android.gms:play-services-auth:16.0.1'
//    implementation 'com.google.android.gms:play-services-plus:16.0.0'
//    implementation 'com.google.android.gms:play-services-gcm:16.0.0'
//    implementation 'com.google.android.gms:play-services-maps:16.0.0'
//    implementation 'com.google.android.gms:play-services-location:16.0.0'
//    implementation 'com.google.android.gms:play-services-places:16.0.0'
//    implementation 'com.google.android.gms:play-services-vision:17.0.2'

//    implementation 'com.google.firebase:firebase-storage:16.0.5'
//    implementation 'com.google.firebase:firebase-messaging:17.3.4'
//    implementation 'com.google.firebase:firebase-core:16.0.7'
//    implementation 'com.google.firebase:firebase-database:16.0.6'
//    implementation 'com.google.firebase:firebase-auth:16.1.0'
//    implementation 'com.firebaseui:firebase-ui-auth:0.6.0'
//
    implementation 'com.google.android.gms:play-services:12.0.1'


    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

标签: androidfirebasefirebase-cloud-messaging

解决方案


推荐阅读