简体   繁体   中英

WebView and front camera does not work on some Samsung devices

In my webview app, I open camera from webview to take pictures and then upload them. Things go fine for most of devices but on Samsung Galaxy 7 and Samsung DUOS, back camera works as expected but front camera show following after I take picture:

在此处输入图片说明

Thing to remember is that nothing happens if I press crop button that is being displayed.

I use following code for opening camera:

private void openCam() {
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    ContentValues values = new ContentValues();
    values.put(MediaStore.Images.Media.TITLE, "Divine");
    values.put(MediaStore.Images.Media.DESCRIPTION, "From your Camera");
    imageUri = getContentResolver().insert(
            MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
    startActivityForResult(intent, 13);
}

Following is my onActivityResult:

    @Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if(requestCode == 13 && resultCode == RESULT_OK) {
    Log.i(TAG, imageUri.toString());
  }
}

This issue arises on Samsung devices only.

The issues may be that:

  • you are using old versions of os / API
  • if you are using the latest androidX then this also might lead to this issue
  • it could be any other incompatibility issue
  • or your Os might have some issue

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM