Exemple #1
0
            public static void Enqueue(
                Context context,
                JobSetting jobSetting
                )
            {
                JobInfo.Builder jobInfoBuilder = new JobInfo.Builder(
                    JOB_ID,
                    new ComponentName(context, Java.Lang.Class.FromType(typeof(ExposureNotDetectedJob))))
                                                 .SetOverrideDeadline(0);

                if (jobSetting != null)
                {
                    jobSetting.Apply(jobInfoBuilder);
                }

                JobInfo jobInfo = jobInfoBuilder.Build();

                JobScheduler jobScheduler = (JobScheduler)context.GetSystemService(JobSchedulerService);
                int          result       = jobScheduler.Schedule(jobInfo);

                if (result == JobScheduler.ResultSuccess)
                {
                    Logger.D("ExposureNotDetectedJob scheduled");
                }
                else if (result == JobScheduler.ResultFailure)
                {
                    Logger.D("ExposureNotDetectedJob schedule failed");
                }
            }
Exemple #2
0
            public static void Enqueue(
                Context context, string token,
                JobSetting jobSetting
                )
            {
                PersistableBundle bundle = new PersistableBundle();

                bundle.PutString(EXTRA_TOKEN, token);

                JobInfo.Builder jobInfoBuilder = new JobInfo.Builder(
                    JOB_ID,
                    new ComponentName(context, Java.Lang.Class.FromType(typeof(ExposureDetectedV1Job))))
                                                 .SetExtras(bundle)
                                                 .SetOverrideDeadline(0);

                if (jobSetting != null)
                {
                    jobSetting.Apply(jobInfoBuilder);
                }

                JobInfo jobInfo = jobInfoBuilder.Build();

                JobScheduler jobScheduler = (JobScheduler)context.GetSystemService(JobSchedulerService);
                int          result       = jobScheduler.Schedule(jobInfo);

                if (result == JobScheduler.ResultSuccess)
                {
                    Logger.D("ExposureDetectedV1Job scheduled");
                }
                else if (result == JobScheduler.ResultFailure)
                {
                    Logger.D("ExposureDetectedV1Job schedule failed");
                }
            }