Pushing photo to Android photo gallery

2,464 views
Skip to first unread message

Ling-Yi Kung

unread,
Jul 18, 2014, 3:11:16 PM7/18/14
to appium-...@googlegroups.com
Is there a way to upload a photo to the photo gallery? There's driver.pushFile(), but I'm not sure where the file is pushed onto the device.

Currently, my tests execute the following through the command line,

adb push /path/to/file /mnt/sdcard/Pictures
adb shell am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///mnt/sdcard/Pictures

but it gets complicated when running on the grid. Is there an example of uploading a photo to the photo gallery using pushFile()? This issue reply said that it's possible.

bootstrap online

unread,
Jul 18, 2014, 3:20:00 PM7/18/14
to Ling-Yi Kung, appium-...@googlegroups.com
example: https://github.com/appium/appium/blob/e6c485df0d07007bfcdd2f3946620022873a6abf/test/functional/android/apidemos/file-movement-specs.js#L18
> --
> http://appium.io
> ---
> You received this message because you are subscribed to the Google Groups
> "Appium-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to appium-discus...@googlegroups.com.
> Visit this group at http://groups.google.com/group/appium-discuss.
> For more options, visit https://groups.google.com/d/optout.

Ling-Yi Kung

unread,
Jul 18, 2014, 3:52:26 PM7/18/14
to appium-...@googlegroups.com, lingy...@gmail.com
So I can push a photo using driver.pushFile("/mnt/sdcard/Pictures", imageBytes), but is there a way to broadcast the intent (which makes the image available in the Gallery)? Or do I have to still do that through the command line? It would be awesome to have a way to execute adb commands without using exec().

bootstrap online

unread,
Jul 18, 2014, 3:56:21 PM7/18/14
to Ling-Yi Kung, appium-...@googlegroups.com
I opened an enhancement request about broadcasting intents.
https://github.com/appium/appium/issues/3172

In terms of arbitrary adb commands, you could open an issue for that.
It's been discussed before and seems unlikely.

Ling-Yi Kung

unread,
Jul 18, 2014, 4:06:58 PM7/18/14
to appium-...@googlegroups.com, lingy...@gmail.com
Awesome, thanks for the enhancement request! :)
Reply all
Reply to author
Forward
0 new messages