Android Question B4A problem webview dont open camera from asp:fileupload

PAULO ROGERIO MARTINS

New Member
Licensed User
Longtime User
Hello,
I need a help to Open camera for input type file ( <asp:fileupload) in Webview not opening using b4a version 6.50
I my program B4A, in my module i use:

img1.png


And I'm using the webviewextras2 library

img2.png




in my project DOT.NET page i use this code html to capture image from camera from celular:


img3.png



img4.png


but, the camera does not open in SAMSUNG GALAXY J5 METAL Android 6.0.1.

img5.png


I need to open the camera directly on the page to capture and save the image. Can you help me with this problem?

Thanks,
 

PAULO ROGERIO MARTINS

New Member
Licensed User
Longtime User
In the manifest editor, I entered the permission line, compiled and replaced the version in the mobile:


'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddPermission(android.permission.CAMERA)
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.


But the result remains the same, the camera does not open.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
It will be difficult to implement it with WebView only. You need to implement onShowFileChooser on Android 5+ and openFileChooser on older versions. I don't think that WebViewExtra2 implements these methods.

As an alternative you can implement the file upload outside of WebView with OkHttpUtils2. You will have full control and it will also be more reliable.
 
Upvote 0

PAULO ROGERIO MARTINS

New Member
Licensed User
Longtime User
When I do the DEBUG in the application, I notice that the WebViewxtras2 library shows in the debug panel:

"AcceptType: image / *"
"Capture: *"

Even if I change in the html to set the FileUpload with the parameter camera, the library disregards the command that I inform "capture" as below:

<Asp: FileUpload ID = "img_Despesa" runat = "server"
Accept = "image / *" width = "1" Height = "1" onChange = 'JSimg_pathUrl (this);' Capture = "camera" />

Interestingly the parameter "AcceptType" the library catches correctly but disregards the "Capture"

Is there any way to set this parameter to "Capture: camera" instead of "Capture: *"?
 
Upvote 0
Top