轉(zhuǎn)載請注明出處:小鋒學(xué)長生活大爆炸[xfxuezhang.cn]文章來源:http://www.zghlxwxcb.cn/news/detail-826950.html
var photoPath = "/sdcard/a.jpg";
var photoFile = new java.io.File(photoPath);
if (!photoFile.exists()) {photoFile.getParentFile().mkdirs();}
try {
photoFile.createNewFile();
} catch (e) {
toast("創(chuàng)建文件失敗: " + e);
return;
}
// 獲取文件Uri
var photoURI = android.net.Uri.fromFile(photoFile);
// 創(chuàng)建Intent啟動相機(jī)
var intent = new android.content.Intent("android.media.action.IMAGE_CAPTURE");
intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, photoURI);
// 啟動相機(jī)應(yīng)用
app.startActivity(intent);
注意要給一下“相機(jī)”權(quán)限,選“僅使用中可用”或者“總是允許”都可以,“每次詢問”可能不大行。文章來源地址http://www.zghlxwxcb.cn/news/detail-826950.html
到了這里,關(guān)于【教程】autojs使用Intent打開相機(jī)拍照并指定存儲路徑的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!