Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Images not shown in photos using adb push pictures to android 11 emulator?

Before android 11, I can use adb push images to /sdcard/DCIM/ directory and use am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d <file path>, then images will show in gallery.

Now I find this approach doesn't work in android 11 emulator, images are pushed to devices, but they won't show without a restart.

Is there anyway I can transfer images from host to emulator and make them appear in photo gallery?

like image 879
Aaron Shen Avatar asked Sep 06 '25 03:09

Aaron Shen


1 Answers

Try:

adb shell am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE\
 --receiver-include-background -d file:///sdcard

Where you can replace /sdcard with the actual path or directory.

https://android.googlesource.com/platform/system/sepolicy/+/85d87cfa6eb808b424f89f41269a3d63586df707%5E%21/

like image 124
Carl G Avatar answered Sep 07 '25 19:09

Carl G