-
-
Save miguelmontemayor/709e217791f320dbb36f2c12d4a0fa6f to your computer and use it in GitHub Desktop.
Storing cookie data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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