모바일 사이트를 만들어 안드로이드 webview를 통해 접속하여 사용중인데
파일 업로드시(input type='file') 아래 소스와 같이 처리 하고 있었습니다.
그런데 젤라빈 업데이트후 input file을 클릭해도 아무런 반응이 없습니다 ㅠㅠㅠㅠ
ics를 사용하는 다른 사람에게 테스트 요청하니 ics에서는 잘된다고 합니다 ㅠㅠㅠㅠ
물론 스마트폰 기본 브라우저로 접속해도 정상 작동 합니다 ㅠㅠㅠㅠ
openFileChooser 메소드에 접근하면 toast 를 띄우게 해놨는데 반응이 없는걸로 보아선
젤라빈에서 webview가 업데이트 되면서 openFileChooser 가 안먹는거라고 추정만 하고 있습니다.
다른 모바일 사이트들도 젤라빈에서 파일첨부시 저와 같은 문제가 발생하고 있을듯 하고
이슈가 될법도 한데 아무리 검색을 해봐도 마땅한 해결방법을 못찾겠네요;;
저와 같은 상황에 처하신 분이나 해결방법을 알고 계신분은 답변 부탁드립니다 ㅠㅠㅠ
wv.setWebChromeClient(new WvChromeClient(this,mProgressHorizontal){
// The undocumented magic method override
// Eclipse will swear at you if you try to put @Override here
public void openFileChooser(ValueCallback<Uri> uploadMsg) {
Toast.makeText(WebViewACT.this,"11111", 3).show();
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
WebViewACT.this.startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE);
}
// For Android 3.0+
public void openFileChooser( ValueCallback<Uri> uploadMsg, String acceptType )
{
Toast.makeText(WebViewACT.this,"2222", 3).show();
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
WebViewACT.this.startActivityForResult( Intent.createChooser( i, "File Chooser" ), FILECHOOSER_RESULTCODE );
}
});
1 감사합니다. 덕분에 브라우저 소스보고 해결하였습니다.
소스는 아래와 같습니다.
// For Android < 3.0
public void openFileChooser( ValueCallback<Uri> uploadMsg ){
openFileChooser( uploadMsg, "" );
}
// For Android 3.0+
public void openFileChooser( ValueCallback<Uri> uploadMsg, String acceptType ){
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
startActivityForResult( Intent.createChooser( i, "File Chooser" ), WebViewACT.FILECHOOSER_RESULTCODE );
}
// For Android 4.1+
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
openFileChooser( uploadMsg, "" );
}




젤리빈 버전 기본 웹브라우저 소스 보고 분석해보세용..
https://github.com/android/platform_packages_apps_browser/tree/jb-release