I am working on an application which shows a list of web views in a recyclerview. There can be 2 kinds of web views in this list
- Authentication web views: Which load all the urls including those which require authentication (Authentication is managed via CookieManager).
- Non-authentication web views: Which load all the urls except those which require authentication. For authentication urls, these web views should show login page to user and once logged in should move to the url.
Now the issue I am running into is that CookieManager is a singleton. If I change cookie settings for web view #2, it affects the authenticated urls in web view #1 and vice versa [since it’s a recycler view so the state of CookieManager is a bit unpredictable when web views in different view-holders load the url].
A hack is to create different instances of CookieManager but it is deprecated and might become a system API in future.
Anyone who has faced a similar problem and found any solution to this?
I have tried changing cookie settings in either of the web views, but still facing issues.
I checked with iOS developers and they have a concept of persistent/non-persistent cookies which allows them custom settings for different web views. I didn’t find any similar APIs on Android.
Also, explored other SO threads or links but didn’t find a solution to this problem.