Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: 数据库增量更新 #195

Open
andannn opened this issue Nov 25, 2024 · 1 comment
Open

Android: 数据库增量更新 #195

andannn opened this issue Nov 25, 2024 · 1 comment
Labels
android feature New feature or request

Comments

@andannn
Copy link
Owner

andannn commented Nov 25, 2024

  • 现状
    目前使用了Job Service监听media store变化, 当变化时会触发全量查询,扫描出所有的Media,Album,Artist,Genre后, 把本地数据库中的相关表清空, 再全部插入。

  • 缺点

  1. 这样的做法会导致当数据量很大时, 全量查询很耗时。

  2. 还有当本地文件有些微少量变更时, 对本地数据库做全量删除, 全量插入, 操作比较重。

  • 改进
  1. Job Service可以监听到具体是哪个uri变化了, 可以只处理变化的情况。
    参考:
    https://android.googlesource.com/platform/development/+/master/samples/ApiDemos/src/com/example/android/apis/content/PhotosContentJob.java
  2. 先把1做了再考虑
@andannn andannn added feature New feature or request android labels Nov 25, 2024
@andannn
Copy link
Owner Author

andannn commented Dec 16, 2024

#225

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant