在work manager android中3天后未触发通知

在work manager android中3天后未触发通知,android,notifications,android-workmanager,Android,Notifications,Android Workmanager,我试图通过WorkManager安排3天后的通知,但没有触发。我试过以下方法 第三条通知员 public class ArticleNotificationWorker extends Worker { private static final String WORK_RESULT = "work_result"; Context mContext; public static final String FROM_ARTICLE_NOTIFICATIONS = "Art

我试图通过
WorkManager
安排3天后的通知,但没有触发。我试过以下方法

第三条通知员

public class ArticleNotificationWorker extends Worker {

    private static final String WORK_RESULT = "work_result";
    Context mContext;
    public static final String FROM_ARTICLE_NOTIFICATIONS = "ArticleNotifications";


    public ArticleNotificationWorker(
            @NonNull Context context,
            @NonNull WorkerParameters params) {
        super(context, params);
        mContext = context;


    }



    @NonNull
    @Override
    public Result doWork() {
        //create notifications only after three days of unlocking the article
        buildAndSendNotification();
        Data outputData = new Data.Builder().putString(WORK_RESULT, "Jobs Finished").build();
        return Result.success(outputData);

    }

    private void buildAndSendNotification(){
       //send notification
    }



}

WorkManager请求如下所示


如果您能帮我解决这个问题,我将不胜感激。

我记得有一次我用WorkManager安排了一项服务,但当应用程序关闭时,它并没有触发服务,结果是因为我在mi手机上测试它。在您使用的手机上查看您的操作系统。

这是唯一的一次性请求吗?是的。这是唯一的一次性请求
OneTimeWorkRequest request = new OneTimeWorkRequest.Builder(ArticleNotificationWorker.class)
                .setInitialDelay(3, TimeUnit.DAYS)
                .addTag(IAppConstants.ARTICLE_NOTIFICATION)
                .build();

        workManager.beginUniqueWork(IAppConstants.ARTICLE_NOTIFICATION_WORK, ExistingWorkPolicy.REPLACE,
                request)
                .enqueue();