$ cookies.put()需要30秒才能将Cookie保存到Android磁盘上 [英] `$cookies.put()` takes 30 seconds to save the cookie on disk on Android

查看:93
本文介绍了$ cookies.put()需要30秒才能将Cookie保存到Android磁盘上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上下文:

  • 我们有一个cordova应用程序正在加载一个在线网站.(我们基本上将Cordova用于插件)
  • 我们使用 $ cookies.put()
  • 存储cookie
  • 它在桌面浏览器和iOS上运行良好(只要我们在Cookie)

问题:

在Android上,如果用户在调用 $ cookies.put()后30秒内杀死应用程序,则cookie将在下次重启时消失.

On Android if the user kill the application with 30 seconds after $cookies.put() is called the cookie will be gone on the next reboot.

如果用户等待30秒以上(例如35秒或更长时间),则一切正常.

If the user wait more than 30 seconds (like 35 seconds or more) everything works fine.

问题:

我们如何强制即时保存cookie(或至少更快)?

How can we force the cookie to be saved instantly (or at least much faster)?

注释:

  • Adding options on the cookie does not change anything
  • I tried to replace the system browser with crosswalk using cordova-plugin-crosswalk-webview but it does the same thing

推荐答案

我遇到了同样的问题,并制作了一个小插件(仍在开发中)来解决该问题.

I had the same problem and made a small plugin (still work in progress) to fix that.

它公开了flush方法,该方法会将您的cookie修改(放置和删除)应用于持久性内存.

It exposes the flush method, which will apply your cookie modifications (put and remove) to persistent memory.

链接到cordova-plugin-cookie-manager

请随时贡献.

这篇关于$ cookies.put()需要30秒才能将Cookie保存到Android磁盘上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆