I'm writing an automation script to check my new photo gallery application. I've been trying to get am to show images using the ACTION_VIEW intent but for some reason it doesn't work. Here's what I've tried:
adb shell am start -a android.intent.action.VIEW -d "file:///sdcard/Android/test.jpg"
or
adb shell am start "file:///sdcard/Android/test.jpg"
however, both commands fail with the follo开发者_Python百科wing error:
Starting: Intent { act=android.intent.action.VIEW dat=/sdcard/Android/test.jpg } Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=/sdcard/Android/test.jpg flg=0x10000000 }
Any ideas?
Thanks.
You need a MIME type on that Intent
via the -t
switch. See this SO question and answer for more details.
精彩评论