오늘 서비스중인 앱에서 농협으로 결제시 결제가 안된다는 문의를 받았습니다.
보니까 Android5.0 / API LEVEL 21 부터 아래와 같은 내용이 추가되있더군요
If your app targets API level 21 or higher:
- The system blocks mixed content and third party cookies by default. To allow mixed content and third party cookies, use the
setMixedContentMode()
andsetAcceptThirdPartyCookies()
methods respectively. - The system now intelligently chooses portions of the HTML document to draw. This new default behavior helps to reduce memory footprint and increase performance. If you want to render the whole document at once, disable this optimization by calling
enableSlowWholeDocumentDraw()
. - If your app targets API levels lower than 21: The system allows mixed content and third party cookies, and always renders the whole document at once.
이말은 즉슨
웹뷰로 페이지를 띄우면 해당 페이지에서 처리되는 내용들의 쿠기가 설정에 따라 webview에서 block시켜버린다는 의미입니다
즉 일부 PG사들은. 아니 일부가 아니고 유일하게 농협 만안되는 겁니다
그럼 어떻게 해야할까요?
쿠기 옵션을 꺼주면 됩니다.
if (Build.VERSION.SDK_INT >= 21){
mWebview.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setAcceptCookie(true);
cookieManager.setAcceptThirdPartyCookies(mWebview, true);}
간단하죠?
위 처럼 쿠키옵션을 직접 명시해주면 됩니다
MIXED_CONTENT_ALWAYS_ALLOW : 항상 허용
MIXED_CONTENT_COMPATIBILITY_MODE : 호환성 모드
MIXED_CONTENT_NEVER_ALLOW : 허용 안함
차고로 킷캣은 MIXED_CONTENT_ALWAYS_ALLOW 가 기본값입니다
'개발 > Android 개발 주저리' 카테고리의 다른 글
[Android] 갤러리에서 랜덤으로 이미지 1장 가져오기 (1) | 2015.09.08 |
---|---|
[Baas] Android Push 서비스 구성하기 #1 - Parse를 이용한 Push(GCM) 수신하기 (4) | 2015.07.22 |
[Android]코드상에서 keystore의 keyhashd생성하기 (0) | 2015.02.23 |
[Android Studio] assembleRelease를 이용하여 배포하기( signingConfigs 자동사이닝 ) (0) | 2015.01.14 |
Android Studio1.0 출시 및 기존 베타버전 사용자가 수정해야할 옵션은? (0) | 2014.12.12 |