特定时间的后台抓取

编程入门 行业动态 更新时间:2024-10-26 02:29:01
本文介绍了特定时间的后台抓取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在寻找解决方案以在后台模式下获取数据,即使应用程序已终止. 有很多关于此问题的教程和答案,但是我的问题与其他问题不同.我在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.

更多推荐

特定时间的后台抓取

本文发布于:2023-11-27 10:07:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637633.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:后台   时间

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!