m.facebook.com을 탐색하도록 설계된 Android WebView가 있으며 이미지 업로드 작업에 문제가 있습니다. 내 WebView의 페이스 북에있는 이미지 업로드 버튼을 클릭해도 아무런 변화가 없습니다.Android WebView m.facebook.com에서 이미지 업로드 허용
나는 m.facebook.com 웹 사이트에 눌러 오전 버튼이 하나 다음과 같이
나는 나의 WebChromeClient을 정의했습니다 : 나는 치라의에서했다
_webview.setWebChromeClient(new WebChromeClient() {
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) {
// BREAKPOINT HERE
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
MainActivity.this.startActivityForResult(Intent.createChooser(i, ""), MainActivity.FILECHOOSER_RESULTCODE);
}
// For Android < 3.0
public void openFileChooser(ValueCallback<Uri> uploadMsg) {
openFileChooser(uploadMsg, "");
}
// For Android > 4.1
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture){
openFileChooser(uploadMsg, "");
}
});
이 이전 스택 오버플로 게시물의 답변 : Android WebView File Upload
내 "// BREAKPOINT HERE "코멘트는 m.facebook.com에서 사진 업로드 버튼을 누른 후에도 적중되지 않습니다. READ_EXTERNAL_STORAGE 권한 세트가 있습니다. 내 최소 API 버전은 9입니다 내 목표는 21
다음과 같이 내가 정의 나는 또한 WebViewClient를 설정 한:
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:alwaysRetainTaskState="true"/> <!-- Remove this if this doesn't correct the crashing issue -->
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
: 내 매니페스트의 일부를 포함했다 완성도를 들어
private class MyWebViewClient extends WebViewClient {
Activity activity;
public MyWebViewClient(Activity myActivity){
activity = myActivity;
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url){
// This function is never called when I click the upload photo
// button.
// ... Do Stuff
}
public void onLoadResource(WebView view, String url){
// The following if statement's predicate returns false if the
// upload image button is pressed, so it's contents are of no consequence
if(url.startsWith(LINK_STRING)){
// ...
}
}
}
내 질문은 : 갤러리 및 카메라의 WebView 구성 요소 업로드 이미지를 허용하려면 어떻게해야합니까?
제공 할 수있는 도움에 감사드립니다.
: 에 https : // 코드를 .google.com/p/chromium/issues/detail? id = 278640 테스트 기기가 실행되고있어 문제 일 수 있습니다. 4.4.2 휴대 전화를 업데이트 할 예정입니다. 내일은 그 고민을 해결하면 참조하십시오 – officialhopsof