Java 云消息计划发送不起作用

Java 云消息计划发送不起作用,java,android,firebase,push-notification,firebase-cloud-messaging,Java,Android,Firebase,Push Notification,Firebase Cloud Messaging,大家好,正如标题所示,我在Firebase云消息方面有一个问题,即使设备长时间不打开应用程序,接收通知的效果也很好,但是问题发生在我第一次发送作品时通过控制台firebase li安排每日通知并将通知发送到所有设备时,而第二天在计划时间内通知不再收到,并且这个问题我不知道如何解决,我尝试了所有方法但没有任何解决方案,每天的通知都没有收到,你能帮我吗?谢谢 @SuppressLint("MissingFirebaseInstanceTokenRefresh") public c

大家好,正如标题所示,我在Firebase云消息方面有一个问题,即使设备长时间不打开应用程序,接收通知的效果也很好,但是问题发生在我第一次发送作品时通过控制台firebase li安排每日通知并将通知发送到所有设备时,而第二天在计划时间内通知不再收到,并且这个问题我不知道如何解决,我尝试了所有方法但没有任何解决方案,每天的通知都没有收到,你能帮我吗?谢谢

@SuppressLint("MissingFirebaseInstanceTokenRefresh")
public class MyFirebaseMessagingService extends FirebaseMessagingService {

    /*public static int NOTIFICATION_ID = 1;*/
    public static String NOTIFICATION = "notification";
    public static String NOTIFICATION_CHANNEL_ID = "com.fourapper.forpaper.channel";

    @Override
    public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {

        generateNotification(remoteMessage.getNotification().getBody(), remoteMessage.getNotification().getTitle());

    }

    private void generateNotification(String body, String title) {

        Intent intent = new Intent(this, MainActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);

        /*PendingIntent pendingIntent = PendingIntent.getActivities(this, 0 , new Intent[]{intent}, PendingIntent.FLAG_ONE_SHOT);*/
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);

        Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);

        /*NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this);*/
        NotificationCompat.Builder builder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID);
        builder.setAutoCancel(true)
                .setDefaults(Notification.DEFAULT_ALL)
                .setSmallIcon(R.drawable.ic_logo_forpapaer)
                .setVibrate(new long[]{100, 500})
                .setSound(soundUri)
                .setContentTitle(title)
                .setContentText(body)
                .setContentInfo("info")
                .setPriority(NotificationCompat.PRIORITY_DEFAULT)
                .setContentIntent(pendingIntent);

        NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);

        Notification notification = null;
        if (intent.hasExtra(NOTIFICATION)) {
            notification = intent.getParcelableExtra(NOTIFICATION);
        }

        int notificationId = (int) System.currentTimeMillis();
        notificationManager.notify(notificationId, notification);

        /*if(NOTIFICATION_ID > 2147483646){
            NOTIFICATION_ID = 0;
        }*/

        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
            NotificationChannel notificationChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, "Notification", NotificationManager.IMPORTANCE_HIGH);
            notificationChannel.setDescription("Channel");
            notificationChannel.setBypassDnd(true);
            notificationChannel.enableLights(true);
            notificationChannel.setVibrationPattern(new long[]{ 0, 500});
            notificationChannel.enableVibration(true);
            notificationChannel.setImportance(NotificationManager.IMPORTANCE_HIGH);
            notificationManager.createNotificationChannel(notificationChannel);

        }

        notificationManager.notify(notificationId, builder.build());
    }
}
在令牌下面

public class GettingDeviceTokenService extends FirebaseInstanceIdService {

    @Override
    public void onTokenRefresh() {
        String deviceToken = FirebaseInstanceId.getInstance().getToken();
        assert deviceToken != null;
        Log.d("Device Token", deviceToken);
    }
}
以下是firebase云消息传递控制台的照片,用于在收件人时区上午12:00定时发送

发送设置更改屏幕


您可能希望将
?hl=en
添加到Firebase控制台的URL中,以将其切换为英语,然后重新拍摄屏幕截图,因为这将大大增加能够理解屏幕的人数。是的,我刚刚添加了英语屏幕,以便每个人都能理解。谢谢:更易于阅读。:)澄清一下:它说“此消息每个用户一次”,这意味着每个用户只会收到一次消息(无论活动持续多少天)。这就是你要问的吗?或者是新用户的问题,他们在前几天还没有收到消息?问题是每个用户只发送一次计划通知,然后不再发送通知,现在您已经指出了这一点,这可能取决于这个事实,因为现在我已经设置了这个选项:见上面的最后一个屏幕