Is it possible to launch the camera app via Android JSInterface?Currently I can access the test() via javascript from the android code.I want to launch the camera app via javascript by using JSInterface.
jQuery:
$(function() { FastClick.attach(document.body); $('.btn-primary-panel').click(function(){ alert(android.test());// WebViewFragment.Java->JsInterface->getPhoneNumber }); });
Android Code:
public class JsInterface{
public String test()
{
// Here call any of the public activity methods....
return "WebViewFragment.Java->JsInterface->getPhoneNumber";
}
}
Maybe try this:
public class JsInterface{
public void launchCamera()
{
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 0);
}
}
And don't forget the permissions:
<uses-permission android:name="android.permission.CAMERA"></uses-permission>
And then just use
android.launchCamera()
from JS.