问题标签 [android-cookiemanager]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - cookiemanager.setcookie(域,字符串)不工作
我正在开发一个安卓应用程序。我能够接收 cookie,但无法使用 cookiemanager.setcookie(url,string) 设置为 cookiemanager。当我检查 cookiemanager.getcookies(url) 我得到空值。
我在堆栈溢出中尝试过答案,但无法正常工作。任何想法将不胜感激。
android - CookieManager is abstract, cannot be instantiated. Why?
throws "CookieManager is abstract, cannot be instantiated"
I'm importing android.webkit.CookieManager and everything seems fine from the documentation side.
android-cookiemanager - CookieManger 只返回一个 cookie (Android)
所以我有一个加载移动站点的 webView... 默认站点设置第一个 cookie:PHPSESSID...
登录后,我也设置了 UID cookie...但是当我输出 cookie 字符串时,字符串中只有第一个 cookie...什么是我失踪了?
这是代码:
这是我在输出中得到的:
ID/////////////////////////////////////:PHPSESSID=a2bf924cd04ce9ca3aa6fa92fef12b20
但在 Chrome 浏览器中,它显示登录后设置的 2 个 cookie ......所以它应该是:
PHPSESSID=a2bf924cd04ce9ca3aa6fa92fef12b20;UID=123456
基本上 CookieManager 出于某种原因忽略了第二个 cookie ......
当它在 iOS 上运行时,相同的站点也会输出 2 个 cookie。我错过了什么?
java - Java android - CookieHandler - 关闭应用程序后如何保留cookie?
要在 HttpURLConnection 中的每个请求后保留 cookie,应该在应用程序开始时添加 CookieHandler:
但是在应用程序关闭和再次打开时cookies是空的......那么关闭后如何保存cookies?
诸如将它们保存在 SharedPreferences 或文件中并在打开后将它们取回...
我试图让他们使用 CookieStore,但这没有用:...
节省:
加载:
谢谢..
android - 无法调用没有参数的公共 android.webkit.CookieManager()
尝试执行以下操作时出现此运行时异常:
代币类型:
四级:
CookieManager 开发人员文档。
这只发生在 Lollipop 5.1.0 中,我已经在 5.0.2、5.0.0 及更低版本中进行了测试,它工作得很好......它会是什么?我想我要打开一份 Google 问题报告。
谢谢。
android - Android 忽略了我的 HTTP POST 中的 cookie
我的应用程序执行 HTTP POSTS,通常该应用程序可以工作,但我遇到了 cookie 问题。我的代码似乎通过 HttpClient 变量并输出了 cookie,但 POST 的结果显示我的应用程序(作为客户端)没有记住任何内容。(当我在我的电脑上使用网络浏览器时,它工作正常,cookie 会记住我的名字)此外,如果重新启动应用程序,cookie 会消失(......但首先要做的事)
这是我的代码:
这是上述代码的 Logcats 中反映的值。cookie 似乎在那里,但 HttpResponse response = httpclient.execute(httppost, context); 似乎忽略了他们。
android - Android Persistent Cookie Store with HTTPUrlConnection
I searched a lot now for the persistence of Cookies but cant find a good solution.
I use HTTPUrlConnection to authenticate against a server and I get Cookies back. I retrieve them in CookieManager and can load them into a new connection. Now I want to persistent that Cookies, perhaps the whole Cookiemanager Object. I found a solution, that you can persist the Cookies with specifying a CookieStore by creating the CookieManager.
I found only old solutions (2-3 years) that say you have to build your own persistent CookieStore, since a persistent CookieStore is not implemented in the SDK? Is this up to date? Is there already a persistent CookieStore implemented in the SDK or does I have to persist the Cookies by myself with SharedPreferences? Or does anybody has a better solution to persist Cookies nowadays?
Best Regards,
android - Volley 忽略 Cookie 标头请求
再会!
我的应用程序使用简单的 http 客户端-服务器通信,在客户端使用 Volley 库建立。首先,我发起了一个授权请求:
在那之后,我请求了与当前用户相关的设备列表。此刻我有一个来自响应头的 cookie。身份验证请求的完整标头响应输出:
- Cache-Control -- 无存储、无缓存、必须重新验证、后检查 = 0、预检查 = 0
- 连接——保持活动
- 内容长度 -- 16
- 内容类型——文本/html;字符集=utf-8
- 日期 -- 格林威治标准时间 2015 年 9 月 18 日星期五 06:15:57
- 到期 -- 格林威治标准时间 1981 年 11 月 19 日星期四 08:52:00
- Pragma -- 无缓存
- 服务器——nginx
- 设置 Cookie -- PHPSESSID=osurmkq1fmnj462c3hk76l1405; 路径=/
- X-Android-Received-Millis -- 1442553247146
- X-Android-Sent-Millis -- 1442553247096
- X-Powered-By -- PHP/5.3.27
在 Auth 请求的 onResponce 回调中,我将 Set-Cookie 值作为 sessionId 并启动 DeviceListRequest:
在这里,我将 sessionId 放在设备列表请求的标头中,但作为响应,我看到了这个:{“status”:false,“error”:“No authorization”}
在台式 PC 上的 Chrome 浏览器中,收到预期的设备列表 - 问题出在 Android 上。
拜托,你能告诉我,我的代码有什么问题吗?也许我在设置标题时错了???
发送请求程序代码:
android - 为什么我将 getRequestProperty("Cookie") 作为空值
为什么我得到getRequestProperty("Cookie")
一个空值?如果可能的话帮助我。我想session
从文件中获取 id php
,我认为我应该使用该getRequestProperty("Cookie")
方法来执行此操作。在下面的代码中,我可以获取hello
值,但无法session
从服务器获取 id 并且getRequestProperty("Cookie")
值为 null。
文件如下PHP
:
android - 尝试在 android webview 中加载带有 url 的 cookie
我正在尝试在 android web 视图中加载 cookie。以下是我的java代码。
WebView布局.xml
我尝试为自定义 cookie 存储实现WebkitCookieManagerProxy,如 -> Pass cookie from HttpURLConnection (java.net.CookieManager) to WebView (android.webkit.CookieManager)中所示。
但它不起作用。当我运行此代码时,在网络视图中,我被重定向到网站的索引页面......