Skip to content

Instantly share code, notes, and snippets.

@miguelmontemayor
Last active April 8, 2019 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miguelmontemayor/709e217791f320dbb36f2c12d4a0fa6f to your computer and use it in GitHub Desktop.
Save miguelmontemayor/709e217791f320dbb36f2c12d4a0fa6f to your computer and use it in GitHub Desktop.
Storing cookie data
// Cookie data is a simple byte array.
val cookieData: ByteArray = byteArrayOf()
// Use PackageManagerCompat to access Cookie API
val packageManager = InstantApps.getPackageManagerCompat(applicationContext)
// Ensure that the cookie data will fit within the store before setting
// the value.
if (cookieData.length <= packageManager.getInstantAppCookieMaxSize()) {
packageManager.setInstantAppCookie(cookieData)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment