简体   繁体   English

什么是获取旅行应用程序数据的好方法

[英]What is good way to obtain data for a travel application

I have ran into a small issue with an Android App that I am currently working on. 我目前正在使用的Android应用程序遇到一个小问题。 I have a list of points of interest declared in an XML file. 我有一个在XML文件中声明的兴趣点列表。 The POI's look like this: POI如下所示:

    <hotel>
    <name>Hotel Atlas</name>
    <latitude>45.612079</latitude>
    <longitude>25.660756</longitude>
    <thumb_url>/hotels/atlas.jpg</thumb_url>
    <phone>039999999</phone>
    </hotel>

The problem that I have is that there are about 200 points of interest and every time the users access the app the XML is read every time from an online location and that means high volumes of internet traffic. 我遇到的问题是,大约有200个兴趣点,并且每次用户访问该应用程序时,每次都会从一个在线位置读取XML,这意味着大量的Internet流量。 The XML is stored online so I can update it every time I want to add another POI and not force users to update the app. XML是在线存储的,因此每次我想添加另一个POI时都可以对其进行更新,而不必强迫用户更新该应用程序。 Is there any way to send this data to the app and not require to download the entire XML? 有什么方法可以将这些数据发送到应用程序,而无需下载整个XML?

I have not yet found an optimum sollution for this and decided to ask for some opinions. 我尚未找到最佳解决方案,因此决定征求一些意见。

Thanks, Vlad 谢谢,弗拉德

There are only 2 possible ways: 只有两种可能的方式:

  1. Either give static database with all POI or 为静态数据库提供所有POI或
  2. Load data from web whenever required. 随时从Web加载数据。

Now you can do one thing, keep static database with App. 现在您可以做一件事,使用App保持静态数据库。 Make web call once app starts and check for the updated data if any changes you made in server database. 应用启动后进行网络通话,并检查服务器数据库中是否有任何更改的更新数据。 If there is any change on server database, then update only those data to the local(static) database. 如果服务器数据库有任何更改,则仅将那些数据更新到本地(静态)数据库。

For implementing above step, you must have to pass Last Updated date to/from server. 要实施上述步骤,您必须必须向/从服务器传递上次更新日期 I mean whenever you make web call, you need to pass last updated date from the client, server will check for new data to be updated post this date. 我的意思是,每当您进行网络通话时,您都需要从客户端传递上次更新日期,服务器将检查该日期之后要更新的新数据。 Server will store client date as updated date and return back to client. 服务器会将客户端日期存储为更新日期,然后返回客户端。

Maybe it's possible to store POIs like "One POI - One file"? 也许可以存储“一个POI-一个文件”之类的POI? In this case you can easily read only new points from server 在这种情况下,您可以轻松地仅读取服务器中的新点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM