2016-10-16 46 views
2

我正在開發angularJS web應用程序。當用戶想要在移動設備上上傳圖片時,設備應該啓動攝像頭,用戶可以拍照並上傳。用angularjs和cordova上傳相機圖像

這是代碼片段我測試

<input type="file" name="uploadedfile" accept="image/*" capture="camera" /> <input type="file" name="uploadedfile2" accept="image/*" capture /> <input id="myFileInput" type="file" accept="image/*;capture=camera">

所有這三種情況爲Web應用程序在手機瀏覽器測試時工作。 但是,在使用cordova(v6.3.1)製作android應用程序(apk文件)的時候,用戶點擊選擇圖像按鈕時,不能強制手機打開相機。這是我第一次使用cordova從html構建apk文件。

我做錯了什麼?

更新:

科爾多瓦插件我安裝:

<plugin name="cordova-plugin-media-capture" spec="~1.4.0" /> 
<plugin name="cordova-plugin-camera" spec="~2.3.0" /> 
<plugin name="cordova-plugin-android-permissions" spec="~0.10.0" /> 

回答