Android Question WebViewExtras

DNA

Member
Licensed User
Hi Everyone,

Im trying to use weviewextras, but when I want to initialize the webviewextra with the current view the webviewextras does not have an initialize function anymore.

I am trying to maintain the user session when logged into a mobisite to be able to download a file which requires you to login first.

Access is control why the user's session.
 

ronell

Well-Known Member
Licensed User
Longtime User
can you post the relevant codes

edit:
is this how you use webviewextras?
B4X:
dim wv as webview
dim wve as webviewextras
webview.initialize("")

activity.addview(wv,0,0,100%x,100%y)

wve.initialize(wv)

wve.loadurl("https//sample.com")
 
Last edited:
Upvote 0

DNA

Member
Licensed User
Dim MobisiteClient As DefaultWebViewClient
MobisiteClient.Initialize("Client")

MobiSite.Initialize("")
MobiSiteExtras.Initialize(MobiSite)
MobiSiteExtras.SetWebViewClient(MobisiteClient)
MobiSiteExtras.LoadUrl("https://sample.com")
'MobiSiteExtras.SetHttpAuthUsernamePassword("https://sample.com","Realm","username","password")
 
Upvote 0

DNA

Member
Licensed User
Still trying to download the PDF, how do I link a httpjob to a user's session. The user's session is the authentication for the file to be downloaded.
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
ehhrm i dont understand clearly
the website has a login?
can you give the url of the site?
 
Upvote 0

DNA

Member
Licensed User
The MobisiteClient is not releasing the credentials, now when the app starts up, in goes directly into the mobisite, without the login page, how to get the Mobisiteextras to display the login site again clear the cache.
 
Upvote 0

DNA

Member
Licensed User
Perhaps I should give you the full picture.
User logs into a mobisite, which is run on a webviewextras webview.
After the log in the user browser to a section that allow him to download a file, the only snag is that when the user is logged in his session upon log in is the authentication when downloading the file.
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
The MobisiteClient is not releasing the credentials, now when the app starts up, in goes directly into the mobisite, without the login page, how to get the Mobisiteextras to display the login site again clear the cache.
This contradicts to your latest reply
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
I see. You need the webviewxtras.sethttpauth after the login page, try the pagfinshed event..
 
Upvote 0

DNA

Member
Licensed User
This is my code :

Dim site As WebView
site.Initialize("")
Activity.AddView(site, 0, 0, 100%x, 100%y)

Dim siteextras As WebViewExtras
siteextras.Initialize(site)

Dim siteclient As DefaultWebChromeClient
siteclient.Initialize("siteclient")
siteextras.SetWebViewClient(siteclient)

siteextras.LoadUrl("https://sample.com")

The site loaded fine the first execution. Afterwards, the site did not display the login screen, and displayed the screen as if you have already logged in.
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
Post the full code.. Can you? With code tags pls

After you load the url in the webview then go back to activity then the last url is still loaded.
 
Upvote 0

DNA

Member
Licensed User
Unfortunately I cannot publish my fill code, because there is credentials in my code, that give the bearer of these credentials access to company sensitive information.
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
no .. without the credentials ,url's , pass, user(change it all just like you did in the url ," http//sample.com) etc.. just to see the flow of app
 
Upvote 0

DNA

Member
Licensed User
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Dim site As WebView
site.Initialize("")
Activity.AddView(site, 0, 0, 100%x, 100%y)

Dim siteextras As WebViewExtras
siteextras.Initialize(site)

Dim siteclient As DefaultWebViewClient
siteclient.Initialize("siteclient")
siteextras.SetWebViewClient(siteclient)

siteextras.LoadUrl("https://sample.com")
End Sub

Sub siteclient_OverrideUrl(Url As String) As Boolean
If (Url.EndsWith(".pdf")) Then
Dim FileDownload As HttpJob
FileDownload.JobName = "DownloadFile"
FileDownload.Download(Url)
End If

Return False
End Sub

Sub JobDone (Job As HttpJob)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
Log("Job String : " & Job.GetString) -- It is here where I get the Unauthorized Access
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
B4X:
FileDownload.username = ?? ' 
FileDownload.password = ??

i think you can send the credentials via httpjob

the app use the webview get the pdf download link then send it to the activity , credentials not included ..
 
Last edited:
Upvote 0

DNA

Member
Licensed User
I override the URL, get die URL of the pdf, and use this URL to try and download the PDF with the credentials, but still gets unauthorized access
 
Upvote 0

DNA

Member
Licensed User
What is realm, do I have the below statement right
Do I have this right siteextras.SetHttpAuthUsernamePassword("sample.com","SAMPLE","username","password")
 
Upvote 0
Top