我无法在我的虚拟设备上接收推送通知 android

I cannot receive push notification on my vritual device android

我之前在我的虚拟设备中收到过它......但是在我从我的 AVD 卸载并重新安装我的应用程序之后我没有收到任何消息但是在 firebase 控制台中它显示完成状态..请有人帮助我

This is Main Activity 

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ImageButton budbtn=(ImageButton)findViewById(R.id.buddies);
        budbtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent= new Intent(MainActivity.this,BuddiesAct.class);
                startActivity(intent);
            }
        });
        ImageButton prim=(ImageButton)findViewById(R.id.primary);
        ImageButton senior=(ImageButton)findViewById(R.id.senior);
        ImageButton suprsen=(ImageButton)findViewById(R.id.supersenior);
    }
}

Project level built gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.google.gms:google-services:3.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "com.example.zion.kidskount"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    apply plugin: 'com.google.gms.google-services'
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'gr.pantrif:easy-android-splash-screen:0.0.1'
    compile 'com.google.firebase:firebase-messaging:9.0.0'

    testCompile 'junit:junit:4.12'
}

每次您重新安装或清除应用程序数据时,您的 token 都会重新生成。

每次按 here 所述调用 onTokenRefresh() 时记录您的令牌。

因此,获取您的令牌并使用它发送您的推送通知:D