webview - Android CookieSyncManager calling CookieSyncManager.getInstance().stopSync() in onResume() -


I hope someone will shed some light on me because I'm confused as a little "delusional" . I am using a webview in my application, but I feel that it does not always sync my cookies correctly. I have seen many code examples for CookSync Manager and they all call CookieSyncManager.getInstance () To say. StopSync (); Starting from () My question is, how would I stop syncing cookies if my application is being resumed? I should not be calling CookieSyncManager.getInstance (). StopSync (); On () (because) My application is losing focus and will not do anything to sync? Do not I understand the way it works properly?

Here is a code example in which I am speaking. It seems that most other examples use the same or similar code.

OK, so I came to know that the documents I have posted are correct. I apparently have trouble reading just that. But it seems that I am not alone because other tutorials have made the same mistake due to the method of documentation.

To use CookieSyncManager, the application must start the following application from the host application:

CookieSyncManager.createInstance (context)

To set up to sync, call the host application

In the activity. Reproduction (), and call

CookieSyncManager.getInstance (). StopSync ()

In Activity. Stop ().

Personally, I think it makes more sense to write it.

To use CookieSyncManager, the host application must make the following call when the application starts:

CookSync Manager .createInstance (context )

To set up sync, the activity of the host application Regiomi () is required to call

CookieSyncManager.getInstance (). StartSyn C ()

And then to stop syncing the app's activity. Calling current ()

CookieSyncManager.getInstance (). StopSync ()

Live and learn.


Comments