Hi Erel,Why use WebView for this? You should send POST requests with OkHttpUtils2.
That's not the issue at all.So, just get the cookie from Webview after login.
Not sure how to do that, can you please clarify.use a formular and submit the formular. Formulars are send by POST
Private tempPostUrl As String="yourURL"
Private tempPostString As String="yourPostData after encoding URL"
Private bytesOfPOstRequest() As Byte
bytesOfPostRequest=tempPostString.GetBytes("UTF8")
Private jo As JavaObject=yourWebView
jo.RunMethod("postUrl",Array As Object(tempPostUrl,bytesOfPostRequest))
Though I'm not using it any more (replaced such requests with okHttpUtils2), here's how I did it in the past:
Private tempPostUrl As String="yourURL"
Private tempPostString As String="yourPostData after encoding URL"
Private bytesOfPOstRequest() As Byte
bytesOfPostRequest=tempPostString.GetBytes("UTF8")
Thanks a lot, sounds good I will give it a try.
One question with regards to the above. The code says "after encoding the URL"
B4X:Private tempPostUrl As String="yourURL" Private tempPostString As String="yourPostData after encoding URL"
I see that POST data being encoded
B4X:Private bytesOfPOstRequest() As Byte bytesOfPostRequest=tempPostString.GetBytes("UTF8")
At what point tempPostUrl is being encoded?
Thanks
iCAB
Private su As StringUtils
Private tempPostString as string=su.EncodeUrl(originalPostString,"UTF8")
You have to use stringUtils (lib) for this:
B4X:Private su As StringUtils Private tempPostString as string=su.EncodeUrl(originalPostString,"UTF8")