mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 02:56:10 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user