웹뷰에서 카카오톡채널에 채팅하기 버튼을 눌렀을 때
public static final String INTENT_PROTOCOL_START = “intent:”;
public static final String INTENT_PROTOCOL_INTENT = “#Intent;”;
public static final String INTENT_PROTOCOL_END = “;end;”;
public static final String GOOGLE_PLAY_STORE_PREFIX = “market://details?id=”;
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Log.e("WebViewActivity", "shouldOverrideUrlLoading url --> " + url);
if (url.startsWith(INTENT_PROTOCOL_START)) {
Log.e("WebViewActivity", "INTENT_PROTOCOL_START");
final int customUrlStartIndex = INTENT_PROTOCOL_START.length();
final int customUrlEndIndex = url.indexOf(INTENT_PROTOCOL_INTENT);
if (customUrlEndIndex < 0) {
Log.e("WebViewActivity", "customUrlEndIndex < 0");
return false;
} else {
Log.e("WebViewActivity", "customUrlEndIndex --> " + customUrlEndIndex);
final String customUrl = url.substring(customUrlStartIndex, customUrlEndIndex);
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(customUrl)));
} catch (ActivityNotFoundException e) {
final int packageStartIndex = customUrlEndIndex + INTENT_PROTOCOL_INTENT.length();
final int packageEndIndex = url.indexOf(INTENT_PROTOCOL_END);
final String packageName = url.substring(packageStartIndex, packageEndIndex < 0 ? url.length() : packageEndIndex);
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(GOOGLE_PLAY_STORE_PREFIX + packageName)));
}
return true;
}
} else {
return false;
}
}
를 추가하여 페이지 이동을 하게 되면
"이 콘텐츠를 보려면 웹 브라우징 앱을 설치하고 설정하세요" 라고 뜹니다.
ios는 잘 되는데 And는 이런현상이 일어납니다.
이게 무슨 오류인가요? 아니면 뭘 설치해야되는건가요?