With my code below, I have been able to save a cookie, but as soon as I close the application the cookie disappears.
How is this caused and how can I solve it?
.sync() is to force a imediate sync ,and must be called after page load cause it sync RAM with cache , so cookie must be in ram before calling it .
System automatically sync it every 5 mintues if you use this scheme
onCreate:
CookieSyncManager.createInstance(context)
onResume:
CookieSyncManager.getInstance().startSync()
onPause:
CookieSyncManager.getInstance().stopSync()
I think you did not waited 5 mintues so system save cookie.