简体   繁体   English

Android App存储和搜索数据

[英]Android App storing and searching data

I am looking for recommendations on how to have the data setup for a car wash appointment scheduler app I am making for fun. 我正在寻找有关如何为我正在玩的洗车预约调度程序应用程序设置数据的建议。

I think there is a better way to store and search through the information with the way I have it setup below. 我认为有一种更好的方法来存储和搜索信息,方法如下。

So far this is what I have, 到目前为止,这就是我所拥有的,


On an online MYSQL Database: 在在线MYSQL数据库上:

User Table: name, street, zipcode, state, phone, username, password 用户表:名称,街道,邮政编码,州,电话,用户名,密码

Vehicles Table: username, year, make, model, color 车辆表:用户名,年份,品牌,型号,颜色

On the App: 在应用程序上:

SharedPreferences with name, username, street, zipcode, state, phonenumber, password 名称,用户名,街道,邮政编码,州,电话号码,密码的SharedPreferences

SQLiteDatabase with year, make, model and color. 具有年份,品牌,型号和颜色的SQLiteDatabase。


When the user logins on the main activity it checks for the username and password in the User Table on the online server. 当用户登录主要活动时,它将在联机服务器上的“用户表”中检查用户名和密码。 If there is a match it downloads the full user data. 如果匹配,则下载完整的用户数据。 It also downoads all the vehicles that have the correct username from the Vehicles Table. 它还会降低车辆表中所有具有正确用户名的车辆的位置。 Then this data is stored in the app in its proper place (user data in the Shared Preferences and the vehicles each entered into the SQLiteDatabase). 然后,将这些数据存储在应用程序中的适当位置(共享首选项中的用户数据以及分别输入到SQLiteDatabase中的车辆)。

What I am having trouble implementing is a full history of service per vehicle. 我在实施时遇到的困难是每辆车的完整服务历史。 I think there is a more efficient way of getting the vehicle history without searching through an appointments of every users appointments every time I want to show the vehicles history. 我认为,有一种更有效的获取车辆历史记录的方法,而无需每次我想显示车辆历史记录时都搜索每个用户约会的约会。

Any recommendations? 有什么建议吗?

EDIT: The only other idea I have is to create a table on the server and the local SQLite that is the named "username-vehicle-appointments". 编辑:我唯一的另一个想法是在服务器和本地SQLite上创建一个名为“用户名-车辆-约会”的表。 That way it has to search through a smaller table and there is less data to download. 这样,它必须搜索较小的表,并且下载的数据更少。

I am still trying to think a way to have the appointment request and confirmation setup. 我仍在尝试一种方法来进行约会请求和确认设置。

EDIT: 编辑:

Maybe have a new table on the server that is named new-appointments. 也许在服务器上有一个名为new-appointments的新表。 The app could check the new-appointments table every few minutes to see if there are new appointment requests? 该应用程序可以每隔几分钟检查一次新的约会表,以查看是否有新的约会请求?

Does this sound like a good way to do this? 听起来像是执行此操作的好方法吗?

Thanks! 谢谢!

Not sure if this could help but have you thought about making an API and storing everything in JSON instead? 不确定是否有帮助,但是您是否考虑过制作API并将所有内容存储在JSON中? It might work out better for your needs 它可能会更好地满足您的需求

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

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