I am using the Phonegap API to capture an image.
Once i take the picture and attach it my success call back method is not called .
Here is how i have implemented it.
- I have added the Phonegap.jar file to the libs also added this to the build path .
And on my Main Activity which extends the DroidGap class i specify super.loadUrl("http://test.someU.com/Android/testandroid.html");
This page testandroid.html contains a reference to the PhoneGap.js script file also another js called the main .
On click of the camera button the camera opens but on attach of the captured image the success callback method is not called .
function dump_pic(data) { alert(data); 开发者_运维技巧 } function fail(msg) { alert(msg); } function show_pic() { navigator.camera.getPicture(dump_pic, fail, { quality: 50 }); }
On successfull attach of the taken picture it has to call the dump_pic with it base64 data being alerted nothing happens.
Now , If i implement the same but with slight differences That is i under the assets folder have a www folder under which i have a file say index.html and the same above code the only difference here is the super.loadUrl method changes to super.loadUrl("file:///android_asset/www/index.html"); as the phonegap example does it in that case everything just works fine it called t he success call back method also the failure method in case of a failure .
The application i have implemented is a web app and has to work some how by the first method . Any idea as to how to get through this . Thanks any help is greatly
this is correct behaviour of a phonegap app for security reasons.
If you could access the camera from a webpage loaded in the Webview this would open a lot of possible security hazards.
You have to load the camera from the local index.html file.
Take a look in how to deploy your app on the phone und and use market place for updates.
精彩评论