我该如何实现朋友的数据加载?

时间:2022-09-20 11:17:50

I'm writing an Android app using the phone number as the ID. I am getting all the contacts from the client's phone. I want to display to the user all of his contacts whom installed the app (just like whatsapp).

我正在使用电话号码作为ID编写Android应用程序。我从客户的电话中获取所有联系人。我想向用户显示他安装应用程序的所有联系人(就像whatsapp一样)。

I was thinking about sending to the server all of the contacts and execute a search for each one of them to check if they exist in the db, and send back all the registered players. I am afraid this implementation will slow my app since I have to load all of his friends on every loading page (in case of new contacts that installed the app, or deleted and so on)

我正在考虑向服务器发送所有联系人并对其中的每一个执行搜索以检查它们是否存在于数据库中,并将所有已注册的玩家发回。我担心这个实现会减慢我的应用程序,因为我必须在每个加载页面上加载他的所有朋友(如果新的联系人安装了应用程序,或删除了等等)

What are your thoughts about it?

你对此有何看法?

1 个解决方案

#1


Use a contacts cache and invalidate/recreate it whenever the contacts DB change, use code such as how to listen for changes in Contact Database. That should make your suggested approach fast enough.

使用联系人缓存并在联系人DB更改时使其无效/重新创建,使用代码(如如何监听联系人数据库中的更改)。这应该使你建议的方法足够快。

Cheers.

#1


Use a contacts cache and invalidate/recreate it whenever the contacts DB change, use code such as how to listen for changes in Contact Database. That should make your suggested approach fast enough.

使用联系人缓存并在联系人DB更改时使其无效/重新创建,使用代码(如如何监听联系人数据库中的更改)。这应该使你建议的方法足够快。

Cheers.