Пример #1
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            var driver     = new GooglePlayDriver(this);
            var dispatcher = new FirebaseJobDispatcher(driver);

            dispatcher.Cancel("my-job-service-tag");

            var myJob = dispatcher.NewJobBuilder()
                        .SetService <BackgroundJobService>("my-job-service-tag")
                        .SetTrigger(Trigger.ExecutionWindow(2, 5))
                        .SetLifetime(Lifetime.Forever)
                        .SetRecurring(true)
                        .Build();

            dispatcher.MustSchedule(myJob);

            global::Xamarin.Forms.Forms.Init(this, bundle);

            LoadApplication(new App());
        }
Пример #2
0
        private void startJob()
        {
            IDriver driver = new GooglePlayDriver(this);
            FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(driver);

            JobTrigger myTrigger = Trigger.ExecutionWindow(30, 60);
            Job        myJob     = dispatcher.NewJobBuilder()
                                   .SetService <DemoJob>("demo-job-tag")
                                   .SetLifetime(Lifetime.Forever)
                                   .SetRecurring(true)
                                   .SetTrigger(myTrigger)
                                   .Build();

            dispatcher.MustSchedule(myJob);
        }