Is there a way to refresh music player programmatically in android?

I made an app that downloads files with MP3 extension using Nativescript-Vue. I use my android phone (Xiaomi Redmi Note 9 Pro) for debugging. I can play the downloaded files using the built-in music player (Mi Music). However when I try downloading files from a Samsung device, I noticed the music player does not update its files immediately. If I try rebooting the phone, the files appear and can be played without any problem. But it is SO FRUSTRATING to reboot the phone every time a user downloads a file.

The weird thing is, Music Player updates itself when I download an MP3 file from the internet with Chrome. I guess a download from the browser somehow triggers music player to refresh its contents. Is there a way to do the same thing programmatically inside my app after it is downloaded? Or any other approach to solve this problem is very appreciated!

Source: Ask Javascript Questions

LEAVE A COMMENT