FirebaseJobDispatcher 在重新启动设备后无法启动



我的FirebaseJobDispatcher在重新启动设备后无法启动。我需要调度程序在设备重新启动后自动启动。

FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(context));
    Job myJob = dispatcher.newJobBuilder()
            .setService(ServiceAppControl.class)
            .setTag(AppGlobal.LOG_TAG)
            .setRecurring(false)
            .setLifetime(Lifetime.FOREVER)
            .setTrigger(Trigger.executionWindow(0, 5))
            .setReplaceCurrent(false)
            .setRetryStrategy(RetryStrategy.DEFAULT_EXPONENTIAL)
            .setConstraints(
                    // only run on an unmetered network
                    Constraint.ON_UNMETERED_NETWORK,
                    // only run when the device is charging
                    Constraint.DEVICE_CHARGING
            )
            .build();
    dispatcher.mustSchedule(myJob);

您是否将此权限添加到清单中?

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

相关内容

  • 没有找到相关文章

最新更新