Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have create a website superration.com and i am create android app in webview, when i open website on mobile browser camera is working fine taking picture and storing image on server but in webview i am not able to open camera in webview.

What I have tried:

public class
MainActivity extends Activity {


//private Button button;
private WebView webView;
public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

//Get webview
webView = (WebView) findViewById(R.id.webView1);

webView.setBackgroundColor(Color.TRANSPARENT);
webView.setBackgroundResource(R.drawable.background);



startWebView("http://superration.com");

webView.clearCache(true);
webView.clearHistory();
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webView.getSettings().setMediaPlaybackRequiresUserGesture(true);




}

private void startWebView(String url) {

//Create new webview Client to show progress dialog
//When opening a url or click on link

webView.setWebViewClient(new WebViewClient() {
ProgressDialog progressDialog;

//If you will not use this method url links are opeen in new brower not in webview
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}



});


webView.loadUrl(url);


}

// Open previous opened link from history on webview when back button pressed

@Override
// Detect when the back button is pressed
public void onBackPressed() {
if(webView.canGoBack()) {
webView.goBack();
} else {
// Let the system handle the back button
super.onBackPressed();
}
}

}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900