Seem i ask many question related to using native.webview on Android device does not allow me to browse to gallery and i cannot upload any photos and no one going to answer this.
It’s probably because in the 5 posts you’ve made about this issue, not 1 of them has any code so that we can see what you are trying to do.
For example I have no idea what you mean by:
_"_native.webview on Android device does not allow me to browse to gallery". What gallery?
_"_i cannot upload any photos" - upload them to where? Your own server? S3? Facebook?
The Corona staff are busy guys, you need to make it easy for them (and other Corona devs) to help you by giving them as much information as possible as described by roaringgamer here
Hi @Alan QuizTix, maybe it’s difficult to them to understand what i meant.
the problem is about using native.webview on Android device, and in the website that we using in the webview there an upload_photo button and when we touch on that button it normally prompt to device photo for us to select any photo to upload, this working in IOS device but it has no action in using Android device when we use the webview api.
Let me take a guess at this. Many things we use, like the camera widget, we just call the OS’s built in features. They provide an SDK we call it and get what features the SDK gives us. Maybe the iOS one understands how to open a file picker and the Android one does not. I’ll ask the Engineers, but it will just confirm this. Given our current priorities, if its something we could do, we may not get to it for a while.
All of that said, if it’s possible, the best thing you can do is go to http://feedback.coronalabs.com and enter a feature request for this and get it voted up.
Rob
Can you provide me the HTML/JS/CSS you are using for your webView or the URL you’re loading? Also the code where you’re calling the webView and it’s event handler as well.
Thanks
Rob
@Rob for calling the webview I am calling with this.
local webView = native.newWebView( display.contentCenterX, display.contentCenterY, display.contentWidth, 320 )
webView:request( “some website” );
webView.x = display.contentCenterX
webView.y = display.contentCenterY
I already test with many website including mine, when i click on upload button on webpage there nothing prompt for me to select any photo to upload, this case happened in Android device. but in IOS device it does prompt to photo gallery and allow me to select any photo to upload. Can you test with any website that has upload action with this webview api and test with Android device?
Thanks
I need you to help me help you. It appears you are not creating your own HTML but using an existing website. Can we get that website? We can’t just make up an upload button. There are no standard upload scripts for the web, they all work a bit differently. Some use MIME encoded multi-part files, others use a pure data stream. Some may require something like jQuery.
We need the HTML and such…
Rob
Thank Rob, here my script on HTML file, if using
<html>
<head>
</head>
<body>
<section class=“photo-package”>
<div class=“max-box”>
<h1 class=“title-orange”>Test Upload</h1>
<div class=“option-1”>
<div class=“form-container font-all”>
<div class=“main-style-upload”>
<div class=“style-all”>
<label class=“size-game size-re”>Single Player Cover</label>
<div class=“upload-box” id=“upload”>
<label class=“msg size-game”></label>
</div>
<input accept=“image/gif, image/jpeg, image/png” multiple=“multiple” id=“test-upload” type=“file” name=“gallery[]” class="">
</div>
</div>
</div>
</div>
</div>
</section>
<script type=“text/javascript” src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type=“text/javascript”>
$(’#upload’).click(function(){
$(’#test-upload’).click();
});
$(’#test-upload’).change(function(evt){
renderImage(this.files[0],function(url){
if(url){
$(’#upload’).css({‘background-image’:‘url(’ + url + ‘)’,‘background-size’:‘cover’});
}
});
});
function renderImage(file,callback) {
var reader = new FileReader();
reader.onload = function(event) {
the_url = event.target.result
if(typeof callback == ‘function’){
callback(the_url);
}
}
reader.readAsDataURL(file);
}
</script>
</body>
</html>
the script above i test on IOS device with native.newWebview it does prompt and allow me to select any photo,
but on Android device it has no any action when i touch on choose file
This issue has been fixed for devices running Android 5.0 and above.
Unfortunately, there is no official way to do this for versions of Android prior to 5.0.
The fix should come with daily build 2015.2698.
It’s probably because in the 5 posts you’ve made about this issue, not 1 of them has any code so that we can see what you are trying to do.
For example I have no idea what you mean by:
_"_native.webview on Android device does not allow me to browse to gallery". What gallery?
_"_i cannot upload any photos" - upload them to where? Your own server? S3? Facebook?
The Corona staff are busy guys, you need to make it easy for them (and other Corona devs) to help you by giving them as much information as possible as described by roaringgamer here
Hi @Alan QuizTix, maybe it’s difficult to them to understand what i meant.
the problem is about using native.webview on Android device, and in the website that we using in the webview there an upload_photo button and when we touch on that button it normally prompt to device photo for us to select any photo to upload, this working in IOS device but it has no action in using Android device when we use the webview api.
Let me take a guess at this. Many things we use, like the camera widget, we just call the OS’s built in features. They provide an SDK we call it and get what features the SDK gives us. Maybe the iOS one understands how to open a file picker and the Android one does not. I’ll ask the Engineers, but it will just confirm this. Given our current priorities, if its something we could do, we may not get to it for a while.
All of that said, if it’s possible, the best thing you can do is go to http://feedback.coronalabs.com and enter a feature request for this and get it voted up.
Rob
Can you provide me the HTML/JS/CSS you are using for your webView or the URL you’re loading? Also the code where you’re calling the webView and it’s event handler as well.
Thanks
Rob
@Rob for calling the webview I am calling with this.
local webView = native.newWebView( display.contentCenterX, display.contentCenterY, display.contentWidth, 320 )
webView:request( “some website” );
webView.x = display.contentCenterX
webView.y = display.contentCenterY
I already test with many website including mine, when i click on upload button on webpage there nothing prompt for me to select any photo to upload, this case happened in Android device. but in IOS device it does prompt to photo gallery and allow me to select any photo to upload. Can you test with any website that has upload action with this webview api and test with Android device?
Thanks
I need you to help me help you. It appears you are not creating your own HTML but using an existing website. Can we get that website? We can’t just make up an upload button. There are no standard upload scripts for the web, they all work a bit differently. Some use MIME encoded multi-part files, others use a pure data stream. Some may require something like jQuery.
We need the HTML and such…
Rob
Thank Rob, here my script on HTML file, if using
<html>
<head>
</head>
<body>
<section class=“photo-package”>
<div class=“max-box”>
<h1 class=“title-orange”>Test Upload</h1>
<div class=“option-1”>
<div class=“form-container font-all”>
<div class=“main-style-upload”>
<div class=“style-all”>
<label class=“size-game size-re”>Single Player Cover</label>
<div class=“upload-box” id=“upload”>
<label class=“msg size-game”></label>
</div>
<input accept=“image/gif, image/jpeg, image/png” multiple=“multiple” id=“test-upload” type=“file” name=“gallery[]” class="">
</div>
</div>
</div>
</div>
</div>
</section>
<script type=“text/javascript” src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type=“text/javascript”>
$(’#upload’).click(function(){
$(’#test-upload’).click();
});
$(’#test-upload’).change(function(evt){
renderImage(this.files[0],function(url){
if(url){
$(’#upload’).css({‘background-image’:‘url(’ + url + ‘)’,‘background-size’:‘cover’});
}
});
});
function renderImage(file,callback) {
var reader = new FileReader();
reader.onload = function(event) {
the_url = event.target.result
if(typeof callback == ‘function’){
callback(the_url);
}
}
reader.readAsDataURL(file);
}
</script>
</body>
</html>