From ea53727e16223d412fcbba49df79cc68b39f5d93 Mon Sep 17 00:00:00 2001 From: chenwenyu Date: Fri, 28 Sep 2018 16:00:35 -0700 Subject: [PATCH] Android: fix cookies lost on Android 5.0 and above (#19770) Summary: This fixes cookie missing bug on Android 5.0 and above. On Android 5.0 and above, after the app successfully obtains the cookie, you kills the App within 30 seconds and restarts the App. It accesses the interface that needs to carry the cookie and finds that the cookie does not exist. Updated tests for the addCookies function to include test cases specifying Android version, and tested on the command line in my app to make sure it has the expected behavior. Updated tests for the addCookies function to include test cases specifying Android version, and tested on the command line in my app to make sure it has the expected behavior. [ANDROID] [BUGFIX] [Cookie] - Fix cookies lost on Android 5.0 and above Pull Request resolved: https://github.com/facebook/react-native/pull/19770 Differential Revision: D10114102 Pulled By: hramos fbshipit-source-id: 5b4766f02f70541fd46ac5db36f1179fe386ac7a --- .../facebook/react/modules/network/ForwardingCookieHandler.java | 1 + 1 file changed, 1 insertion(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/ForwardingCookieHandler.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/ForwardingCookieHandler.java index 4c1c413cbd899b..222a7ce463652c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/ForwardingCookieHandler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/ForwardingCookieHandler.java @@ -129,6 +129,7 @@ public void run() { for (String cookie : cookies) { addCookieAsync(url, cookie); } + getCookieManager().flush(); mCookieSaver.onCookiesModified(); } }