fix(android): write the session cookie down when the app leaves the screen

The web view flushes new cookies about half a minute after a sign-in; an
app Android ended in that time lost the sign-in it just had.
This commit is contained in:
Maurice
2026-11-14 11:50:51 +01:00
parent e1090d5427
commit ef5deada83
@@ -10,6 +10,7 @@ import android.view.KeyboardShortcutGroup;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.CookieManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
@@ -90,6 +91,18 @@ public class MainActivity extends BridgeActivity {
if (group != null) data.add(group);
}
/**
* The web view keeps new cookies in memory and writes them to disk on its
* own schedule, about half a minute later. An app Android ends in that time
* (swiped away, or reclaimed for memory) forgets the sign-in it just had, so
* the session is written down whenever the app leaves the screen.
*/
@Override
public void onPause() {
super.onPause();
CookieManager.getInstance().flush();
}
@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);