Android 转向 SD 卡行为
我有一个应用程序在运行时从互联网下载大部分资源。 这些资源大部分都是图像。
我不希望用户在图库应用程序或任何其他应用程序中看到这些图像。这个要求对我来说至关重要,因为:
- 我正在跟踪哪些资源已下载以及哪些资源需要稍后下载。
- 所有这些资源对用户来说毫无意义,并且会激怒他。
- 我不希望用户或任何其他应用程序删除这些图像
注意:我知道 root 用户可以做他们想做的任何事情,我不关心这些用户会弄乱应用程序。
为了满足这些要求,我使用了内部存储,它完全按照我的预期和需要工作。
我确实让用户将我的应用程序移动到 SD 卡,但是:
- 我保存在内部存储和数据库中的所有文件发生了什么?
- 它们是否都随应用程序转移到 SD 卡上?它们保留在内部存储中吗?
我相信它们确实保留在内部存储中,但我还没有找到任何相关文档。
在我了解这种行为之后,它会提出一些其他问题。 我唯一的要求是从互联网下载资源,并且用户不会在任何其他应用程序中看到它们。我并不关心这些文件保存在哪里,我认为如果用户决定将应用程序移动到 SD 卡,那是因为他的内部存储空间不足,因此我应该将所有资源转移到 SD 卡上SD 卡。
- 我可以在 SD 卡上保存一些内容而不将这些文件公开给所有人吗?
- 处理这种情况的最佳方法是什么?
- 我有什么选择来处理这种情况?
- 我可以知道应用程序是安装在 SD 卡上还是内部存储上吗?
我感谢大家的见解和建议。
I have an application that downloads most of the resources from the internet during run time.
Most of those resources are images.
I don't want the user to see those images in the gallery application or in any other application. This requirement is crucial to me since:
- I'm tracking which resource was downloaded and which need to be download later.
- All those resources would be meaningless to the user and would irritate him.
- I don't want the user or any other application to delete those images
Note: I'm aware to the fact that rooted users can do what ever they want and I don't care that those user will mess up the app.
To fulfill those requirements I used the internal storage and it works exactly as I expected and as needed.
I do let the user to move my application to the SD card, But:
- what is happening to all the files that I saved in the internal storage and to the DB?
- Are they all moving to the SD card with the application? Do they stay in the internal storage?
I believe that they do stay in the internal storage, but I haven't found any documentation for it.
And after I'll understand the behavior it raise few other questions.
The only requirement that I have is that the resources would be downloaded from the internet and that the user won't see them in any other application. I don't really care where those files are being saved, I think that if the user decides to move the application to the SD card it is since he has lack of memory in the internal storage, therefor I should transfer all my resources to the SD card.
- Can i save something on the SD card without those files to be public for all?
- What is the best way to handle this situations?
- What option do I have to handle this situation?
- Can I know if the app is installed on the SD card or on the internal storage?
I would thank you all for all your insights and recommendations.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于在图库应用程序中不可见的图像,您应该将 .nomedia 文件放入包含图像的文件夹中。 :图像权限(不希望它们出现在图库中)
示例 应用程序到 SD 功能,我也想了解有关该主题的信息,所以我无法帮助您:)
有用的答案:https://stackoverflow.com/a/3687467/334493
Regarding the images not being visible in the Gallery App, you should put a .nomedia file into the folder that contains your images. Example: image permissions (don't want them in gallery)
Regarding the app to SD feature, I also wanted to have info on the subject, so I cannot help you :)
Useful answer: https://stackoverflow.com/a/3687467/334493