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

添付メディアのダウンロード先の設定 #120

Open
motorailgun opened this issue Dec 29, 2019 · 4 comments
Open

添付メディアのダウンロード先の設定 #120

motorailgun opened this issue Dec 29, 2019 · 4 comments

Comments

@motorailgun
Copy link

添付メディアのダウンロード先を、現在/sdcard/Downloadに固定されているものを設定にて変更できるようにできませんでしょうか。

@tateisu
Copy link
Owner

tateisu commented Dec 30, 2019

今はダウンロード処理をまるっとDownloadManagerに投げてるだけなんですよね…。
https://developer.android.com/reference/android/app/DownloadManager

オプションで保存先フォルダが指定されてる時だけ自前でダウンロードしてそこに出力するとかしたら出来るだろうけど、動画とかMisskeyとかだと巨大なデータがありうるので、アプリがバックグラウンドになった後の動作制限に対応するため結局DownloadManagerと同等の処理を自前実装しないといけないので、やや高コストだと思います。

@motorailgun
Copy link
Author

なるほど。思ったより大変でした…。

@tateisu
Copy link
Owner

tateisu commented Dec 30, 2019

発想をかえて「ダウンロード自体はDownloadManagerに任せる。完了イベントを受け取ったらファイルを移動する」というのも検討してみましょう。あれ、でもファイルの移動に時間がかかる(onReceive内部に収まらない)ならサービスを書くのは一緒だからダウンロード処理だけ節約しても工数かわんないな…?

@tateisu
Copy link
Owner

tateisu commented Dec 30, 2019

https://developer.android.com/reference/android/app/DownloadManager.Request.html#setDestinationUri(android.net.Uri)
DownloadManagerに出力先のpathを指定するAPIはあるが、Android Q で増えた制限を見ると出力先にSDカード等は指定できなくなった。

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

No branches or pull requests

2 participants