如何使用齐射从服务器获取最近的数据? [重复]

时间:2022-01-07 08:19:10

This question already has an answer here:

这个问题在这里已有答案:

Am new for android development am really confused where to start with even after lots of research.

对于Android开发而言,我很难搞清楚,即使经过大量研究,也要从哪里开始。

I made a connection with server and fetched the data successfully and I stored it in sharedpreferences when ever the recent data is updated in server that must be displayed and saved into my sharedpreferences. how can I achieve this so far I have used volley to make connection with server how to fetch only recent data from server is there any idea for that as beginner.

我与服务器建立了连接并成功获取数据,并且当服务器中的最新数据更新时,我将其存储在sharedpreferences中,必须显示并保存到我的共享首选项中。到目前为止我如何实现这一点我已经使用volley与服务器建立连接如何从服务器获取最近的数据是否有任何想法作为初学者。

I really confused how to do this This may be dumb question but as of now I struck with this Please share your ideas !!!

我真的很困惑怎么做这可能是一个愚蠢的问题,但截至目前我已经打动了这个请分享你的想法!

2 个解决方案

#1


0  

you can make it simple using one of below way

您可以使用以下方式之一简化

  1. you have to ask server for get data every time you enter in app. if server have new data then fetch from server.

    每次进入应用程序时都需要服务器获取数据。如果服务器有新数据,则从服务器获取。

  2. use Google Cloud Push Notification in your app. whenever new data found server will notify your app that new data arrive then you have to fetch data from server

    在您的应用中使用Google云推送通知。每当发现新数据服务器将通知您的应用程序新数据到达时,您必须从服务器获取数据

#2


0  

You may do like this

你可能喜欢这样

  1. Create a service which gets updated data after some interval from server.
  2. 创建一个服务,从服务器获取一段时间后获取更新数据。
  3. add some column like resent=true by default in table.
  4. 默认情况下在表中添加一些像resent = true的列。
  5. For checking recent or not add unique id when request first time get all data that have recent=true and after getting data set it as recent false.
  6. 当请求第一次获取具有recent = true的所有数据并且在获取数据之后将其设置为最近的假时,用于检查最近或不添加唯一ID。

#1


0  

you can make it simple using one of below way

您可以使用以下方式之一简化

  1. you have to ask server for get data every time you enter in app. if server have new data then fetch from server.

    每次进入应用程序时都需要服务器获取数据。如果服务器有新数据,则从服务器获取。

  2. use Google Cloud Push Notification in your app. whenever new data found server will notify your app that new data arrive then you have to fetch data from server

    在您的应用中使用Google云推送通知。每当发现新数据服务器将通知您的应用程序新数据到达时,您必须从服务器获取数据

#2


0  

You may do like this

你可能喜欢这样

  1. Create a service which gets updated data after some interval from server.
  2. 创建一个服务,从服务器获取一段时间后获取更新数据。
  3. add some column like resent=true by default in table.
  4. 默认情况下在表中添加一些像resent = true的列。
  5. For checking recent or not add unique id when request first time get all data that have recent=true and after getting data set it as recent false.
  6. 当请求第一次获取具有recent = true的所有数据并且在获取数据之后将其设置为最近的假时,用于检查最近或不添加唯一ID。