안드로이드 웹뷰?쪽도 아시는분

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
안드로이드 웹뷰?쪽도 아시는분

QA

안드로이드 웹뷰?쪽도 아시는분

본문

안녕하세요 질문좀 드리고자합니다.

이번에 웹뷰로 하나 어플을 만들었는데요

 

<a href="tel:*** 개인정보보호를 위한 휴대폰번호 노출방지 ***" >

이미지

</a>

 

이런식으로 웹에서는 작업을했는데요 

 그냥 인터넷에서는 잘되는데 웹뷰에서는 

 

다음 이유로 tel:*** 개인정보보호를 위한 휴대폰번호 노출방지 ***의 웹페이지를 로드할 수 없습니다

 

라고나옵니다 ㅠㅠ

구글링 해도 방법을 잘모르겟고

아래링크  설명좀 해주시면 감사하곗습니다

http://frog-rammer.blogspot.kr/2014/07/web-view.html 

 

다 넣었는데 안됩니다 ㅠㅠ

 

AndroidManifest.xml 부분 


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.mobile3cm.alex.webview">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CALL_PHONE"/>
<application
        android:allowBackup="true"
        android:icon="@drawable/icon_gsshop_mobile"
        android:label="/app_name"
        android:supportsRtl="true"
        android:theme="/AppTheme"
        android:hardwareAccelerated="true">
<activity android:name=".MainActivity"
            android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SplashActivity"
            android:screenOrientation="portrait"
            />
</application>
</manifest>

 

 

 

MainActivity.java 부분


package com.mobile3cm.alex.webview;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.webkit.JavascriptInterface;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import java.net.URL;
public class MainActivity extends Activity {
WebView webView;
URL uri;
private ValueCallback<Uri> filePathCallbackNormal;
private ValueCallback<Uri[]> filePathCallbackLollipop;
private final static int FILECHOOSER_NORMAL_REQ_CODE = 1;
private final static int FILECHOOSER_LOLLIPOP_REQ_CODE = 2;
@Override
    protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
startActivity(new Intent(MainActivity.this, SplashActivity.class));
webView = (WebView) findViewById(R.id.wv_mainWebview);
String url = "http://jmoney119.cafe24.com";
try {
uri = new URL(url);
webView.setWebChromeClient(new WebChromeClient() {
// For Android < 3.0
                public void openFileChooser(ValueCallback<Uri> uploadMsg) {
Log.d("MainActivity", "3.0 <");
openFileChooser(uploadMsg, "");
}
// For Android 3.0+
                public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) {
Log.d("MainActivity", "3.0+");
filePathCallbackNormal = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_NORMAL_REQ_CODE);
}
// For Android 4.1+
                public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
Log.d("MainActivity", "4.1+");
openFileChooser(uploadMsg, acceptType);
}
// For Android 5.0+
                public boolean onShowFileChooser(
WebView webView, ValueCallback<Uri[]> filePathCallback,
WebChromeClient.FileChooserParams fileChooserParams) {
Log.d("MainActivity", "5.0+");
if (filePathCallbackLollipop != null) {
filePathCallbackLollipop.onReceiveValue(null);
filePathCallbackLollipop = null;
}
filePathCallbackLollipop = filePathCallback;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_LOLLIPOP_REQ_CODE);
return true;
}
@Override
                public boolean onCreateWindow(WebView view, boolean dialog, boolean userGesture, Message resultMsg) {
// return true or false after performing the URL request
                    WebView newWebView = new WebView(MainActivity.this);
view.addView(newWebView);
WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
transport.setWebView(newWebView);
resultMsg.sendToTarget();
newWebView.setWebViewClient(new WebViewClient() {
@Override
                        public boolean shouldOverrideUrlLoading(WebView view, String url) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW);
browserIntent.setData(Uri.parse(url));
startActivity(browserIntent);
return true;
}
});
return true;
}
});
webView.setWebViewClient(new WebViewClient() {
@Override
                public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return false;
}
});
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.loadUrl(url);
}catch (Exception e){
}
}
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if(url.startsWith("tel:*** 개인정보보호를 위한 휴대폰번호 노출방지 ***")){
Intent dial = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
//현재의 activity 에 대하여 startActivity 호출
            startActivity(dial);
return true;
}
view.loadUrl(url);
return true;
}
@Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
if((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) {
webView.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == FILECHOOSER_NORMAL_REQ_CODE) {
if (filePathCallbackNormal == null) return ;
Uri result = (data == null || resultCode != RESULT_OK) ? null : data.getData();
filePathCallbackNormal.onReceiveValue(result);
filePathCallbackNormal = null;
} else if (requestCode == FILECHOOSER_LOLLIPOP_REQ_CODE) {
if (filePathCallbackLollipop == null) return ;
filePathCallbackLollipop.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, data));
filePathCallbackLollipop = null;
}
}
}

이 질문에 댓글 쓰기 :

답변 1

https://www.google.co.kr/#newwindow=1&q=%EC%9B%B9%EB%B7%B0+tel+%EC%B2%98%EB%A6%AC&spf=1496221218796 

 

안드로이드 웹뷰의 경우 tel, sms 이런 기능들은 별도 처리를 해주셔야 됩니다.

 

검색하면 많은 소스가 나오니 맞는 소스를 선택하셔서 적용하시면 될거 같습니다. 

답변을 작성하시기 전에 로그인 해주세요.
전체 124,392 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT