vfsfitvnm / ViMusic

An Android application for streaming music from YouTube Music.
GNU General Public License v3.0
9.1k stars 885 forks source link

Cache keeps deleting itself #289

Closed Music562 closed 2 years ago

Music562 commented 2 years ago

Steps to reproduce the bug

  1. Listen to a song fully to download it to the "offline" playlist.
  2. Close the app
  3. Open the app again
  4. Check the "offline" playlist, and you'll see that the song you had downloaded has disappeared (sometimes it takes a few hours before it gets deleted).

Expected behavior

I want to be able to access the music I download offline whenever I want to, when I'm offline, without cache getting deleted without my permission.

Actual behavior

The songs' cache keeps getting deleted on its own so I can't listen to songs whenever I want to, when I'm offline.

I have downloaded cache several times, but it keeps deleting on its own. For example, I download a few songs and listen to them on my way to work. Then I close the app when I don't use it anymore. When I open the app again later, error occurs and I see that the songs I listened to earlier, don't play offline anymore.

I have also tried to change the cache limit in the settings to "unlimited", but it keeps deleting my songs anyway.

Screenshots/Screen recordings

Screenshot_20220908-235437

Logs

No response

ViMusic version

0.4.3

Android version

Android 10

Additional information

No response

vfsfitvnm commented 2 years ago

I don't know why it happens - It never happened to me. I guess the system deletes the cache when the device storage free space is going to finish: what's your storage free space?

vfsfitvnm commented 2 years ago

Well, I think the solution here is using filesDir instead of cacheDir

Music562 commented 2 years ago

I don't know why it happens - It never happened to me. I guess the system deletes the cache when the device storage free space is going to finish: what's your storage free space?

It could be. I have 2 GB with free storage left

Music562 commented 2 years ago

How do I do that?

vfsfitvnm commented 2 years ago

It could be. I have 2 GB with free storage left

Well, this is the expected behavior then. I mean, you don't want your device to run out of space!

How do I do that?

You don't have to do anything. This is a change to the codebase.

However, I'm not moving the cache to another directory to prevent it being cleared by the system. You should free your device storage instead - i.e. removing photos, videos or other apps data you don't need anymore.

@jerryop Since you +1 this issue, would you confirm your device has a little free space amount left?

jerryop commented 2 years ago

No bro I have lot of space most probably 40gb+ space but the most phones have a new feature smart ram management that automatically clears cache.

vfsfitvnm commented 2 years ago

The official Android documentation states that: "When the device is low on internal storage space, Android may delete these cache files to recover space."

The "smart ram management feature that most phones have" isn't cited anywhere in the documentation, so it certainly is bloatware. Uninstall or disable it. If you can't, I won't adjust my app to satisfy a shitty vendor decision

jerryop commented 2 years ago

I am using samsung s22 then maybe this feature in oneUi os

Music562 commented 2 years ago

I tried freeing up space and it seemed to help. The music stayed a bit longer than usual.

Music562 commented 2 years ago

But now, 5 days later, all of my playlists and music is gone

Music562 commented 2 years ago

I've had other music apps but this issue has never occurred before, where playlists and cache gets deleted on its own

vfsfitvnm commented 2 years ago

all of my playlists and music is gone

You deleted the app's data

Music562 commented 2 years ago

I only deleted pictures, I didn't delete any apps nor any app data.

It even worked a few days after I had cleared some space. So it has nothing with deleting app data to do. It deleted it all on its own.

Jak2k commented 2 years ago

I think you have cleared the app's chach. Maybe it is done automaticly while cleaning your device.

Music562 commented 2 years ago

Thanks to everyone for your help and quick answers!

Adarshyodha314 commented 1 year ago

Is there any way ;To stop that offline feature. Actually I don't need it but still it stores the songs in offline playlist.

Jak2k commented 1 year ago

Is there any way ;To stop that offline feature. Actually I don't need it but still it stores the songs in offline playlist.

You can delete the app's cache in the app infos.

Adarshyodha314 commented 1 year ago

Is there any way ;To stop that offline feature. Actually I don't need it but still it stores the songs in offline playlist.

You can delete the app's cache in the app infos.

Is it not quite irritating to go in app info and clear cache.

Jak2k commented 1 year ago

You can also change the cache limit in ViMusic > Settings > Cache, but it will reduce the performance for often heard songs.

Subtilizer28 commented 1 year ago

Is there any way ;To stop that offline feature. Actually I don't need it but still it stores the songs in offline playlist.

Set the cache limit to lowest. is 32mb

Fxsch commented 1 year ago

I have the same issue eventhough I have almost 18 gigs free. This makes the cache feature completely useless and is the reason this app used a third of my mobile data this month.

Subtilizer28 commented 1 year ago

I have the same issue eventhough I have almost 18 gigs free. This makes the cache feature completely useless and is the reason this app used a third of my mobile data this month.

I fixed this issue by changing my custom rom

Fxsch commented 1 year ago

An issue with an app shouldn't have to be fixed by installing a different rom. An option to use local storage instead of the cache would be a good workaround if there's no other way to fix this.

Subtilizer28 commented 1 year ago

I did had exact issue with a rom and anyways it had many bugs. Or maybe the extra features the rom provided might clear the cache frequently. Had to switch it anyways

galadinowo commented 1 year ago

me and friends that i suggested this app to constantly have this issue and have yet fo fix it. i dont find the "answer" to be concise; i cant find anything online about how to get android to not automatically clear the cache without the devs answer which was "removing the bloatware," which, even if i knew how to do, i still use many features on my phone that some will consider "bloatware," like various apps not all will find useful. i just want to listen to music offline conveniently, but apparently i cant without mindwiping my phone qwq

galadinowo commented 1 year ago

and yeah, i have automatic cleaning off for vimusic (as an "excluded app") but still nothing! if i leave the app idle for one day all my songs go away

anand-kalsait commented 9 months ago

I am using samsung s22 then maybe this feature in oneUi os

I am using samsung s22 then maybe this feature in oneUi os

Go to device care and in options in upper right corner there is storage booster and in the you can turn off auto delete unnecessary data which clears song cache of ViMusic app

Jak2k commented 9 months ago

It's also in stock android 14.