特定时间的后台抓取 [英] Background Fetch at Specific Time

查看:114
本文介绍了特定时间的后台抓取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找解决方案以在后台模式下获取数据,即使应用程序已终止. 有很多关于此问题的教程和答案,但是我的问题与其他问题不同.我在stackoverflow上找不到任何适当的解决方案,因此发布了此问题.

我有可以解释的情况.我正在使用存储事件日期,名称,时间,地址等的领域数据库.现在的事情是,我想编写一个在后台执行的代码,在此代码中,我想获取所有事件数据并比较它们的日期今天的日期.并根据这两天之间的剩余天数触发本地通知,以提醒用户特定事件还有多少天.

我想每天在当地时间上午8点准确地调用此后台获取方法.

由于与后台获取和实现相混淆,我没有编写任何代码.有人知道如何实现吗?

我们将不胜感激.

解决方案

我有解决问题的解决方案.据我所说,

我想编写一个在后台执行的代码,在此代码中,我 想要获取所有事件数据并将其日期与今天的日期进行比较. 并根据这两天之间的剩余天数触发本地通知 提醒用户特定事件还有多少天.

因此,当我从API获得响应时,我会为所有具有唯一ID的事件创建本地通知,这些事件会在每天的特定时间触发并重复,在该时间我会显示事件时间和事件的剩余天数. >

I am looking for solution to get data in background mode even app is terminated. There are lots of tutorials and answers available for this questions, but my questions is different than other. I haven't find any proper solution on stackoverflow, so posted this question.

I have scenario which I can explain. I'm using realm database which store event date, name, time, address etc. Now the thing is that, I want to write a code which are execute in background, In this code I want to get all event data and compare their date with today's date. And based on days remaining between these days fire local notification to remind user about how many days are remaining for specific event.

I want to call this background fetch method exactly 8 AM in local time everyday.

I haven't write any code due to confused with Background fetch and implementation. Can anyone know how to implement this ?

Help will be appreciated.

解决方案

I have got solution to fix issue. As per I have talked,

I want to write a code which are execute in background, In this code I want to get all event data and compare their date with today's date. And based on days remaining between these days fire local notification to remind user about how many days are remaining for specific event.

So, when I getting response from API, I'm creating local notification for all events with unique id, which are fire and repeat daily at specific time, where I have display event time and remaining days of event.

这篇关于特定时间的后台抓取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆