German kann Cookie nicht speichern

Magneto

New Member
Licensed User
Longtime User
Hallo,
ich habe eine lokale html-Seite die ich mit webview aufrufe. Funktioniert alles bestens. Nun möchte ich ein Cookie setzen. Das geht jedoch nicht.
Hier mein Code:
B4X:
Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
   Dim CookieManager1 As CookieManager
   Dim WebView1 As WebView
End Sub

Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   'Activity.LoadLayout("Layout1")
    WebView1.Initialize("WebView1")
    Activity.AddView(WebView1, 0, 0, 100%x, 100%y)
   
   CookieManager1.SetAcceptCookies(True)
   
   Dim Url As String
   Url="file:///android_asset/index.html"
   WebView1.LoadUrl(Url)

   CookieManager1.SetCookie(Url, "B=123456abcdef")

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub WebView1_PageFinished (Url As String)
   Log("WebView1_PageFinished Url = "&Url)
   If CookieManager1.HasCookies Then
      Log("Cookies: "&CookieManager1.GetCookie(Url))
   Else
      Log("No cookies found")
   End If
End Sub

Und hier die Log-File
B4X:
WebView1_PageFinished Url = file:///android_asset/index.html
Cookies: null
 
Top