android.webkit.CookieSyncManager
To use the CookieSyncManager, the host application has to call the following when the application starts:
CookieSyncManager.createInstance(context)
To set up for sync, the host application has to call
CookieSyncManager.getInstance().startSync()
in Activity.onResume(), and call
CookieSyncManager.getInstance().stopSync()
in Activity.onPause().
To get instant sync instead of waiting for the timer to trigger, the host can call
CookieSyncManager.getInstance().sync()
The sync interval is 5 minutes, so you will want to force syncs manually anyway, for instance in onPageFinished(WebView, String)
. Note that even sync() happens asynchronously, so don't do it just as your activity is shutting down.
오래되서 자세히 기억이나지않습니다만 아는선에서 말씀드리면,
웹뷰에서 로그인성공시에 기록되는 쿠키(세션정보) 값은 물리적데이터로 기록하지않고
메모리에 임시로 올려두고 웹뷰 프로세스가 종료되거나, 일정시간이 경과하면
쿠키값도 같이 소멸되는것으로 기억합니다,,
그래서 메모리에 임시로 기록한 데이터를 물리적데이터로 남겨야 하는데 위에남긴 문서를 참고하시고,
적용해보시기 바랍니다.
제가 개발했을때는 android sdk 가 구버전이여서 그런지 모르겠지만 저방법도 되다 안되다? 하는 이슈가 있었어요
저뿐만아니라 개발자 포럼 사이트에서도 그런이슈들에 대한 글들이 많이올라왔습니다.
그래서 그때는 로그인성공시 세션아이디를 추출해서 쿠키를직접 생성하는 방법을 썼습니다.
위방법으로 안되신다면 댓글을 남겨주세요 같이 고민해보면 답이 나오겠죠,,