my question is I build a android app using kivy and python for video downloader but there is a problem ,problem is when i downloading any video from any website that video immediately not showing in my android mobile media gallery my mobile model is honor 8x and real me6 , even i used to rescan MediaScannerConnection to scan video but not showing downloaded video in android gallery immediately,what is the reason? or tell me how to do in python thanks in advance.
from jnius import autoclass, cast
PythonActivity = autoclass('org.kivy.android.PythonActivity')
currentActivity = cast('android.app.Activity', PythonActivity.mActivity)
context = cast('android.content.Context', currentActivity.getApplicationContext())
Intent = autoclass('android.content.Intent')
Uri = autoclass('android.net.Uri')
MediaScannerConnection = autoclass('android.media.MediaScannerConnection')
MediaScannerConnection.scanFile(context,[path],None, None)
Update: When I use your code, my phone will immediately show picture that I downloaded, so Maybe it is
To refresh the single file in MediaStore on Android, I use this way: (Test on Galaxy A8 2018.)
If this didn't work, try to clean your music player、gallery cache.
For example:
To find file path in primary external storage: