Good morning everyone,
I'm new to both this forum and block programming of Android apps, for practice I'm creating a simple app that displays the content of an external website.
To do this, I am using the "CustomWebView" function as given in the following solution:
CustomWebView : An extended form of Web Viewer
Furthermore, for a "redundancy" aspect, I wanted there to be a check of the status of the web link at startup and if it did not respond correctly, it would switch to the second web link.
I found what user @TIMAI2 created in his explanation of this useful and logical: Check if the link is active, if not, go to the next one
Now however, I have 2 big problems that I can't understand and solve.
The first: "CustomWebView.GoToUrl" doesn't seem to work... I always get just a white screen.
What am I doing wrong? It seemed logical to me to go and get the URL present in view2.url.
The second: if the first domain link is non-existent the app doesn't seem to do anything, I waited more than 5 minutes but the "Link No good" message never appeared.
I thought it might be a problem with the certificate (rightly if a domain is down or non-existent the SSL certificate could/would be missing)
So I implemented what was indicated by user
@vknow360 always in your component guide: CustomWebView : An extended form of Web Viewer - #158 by vknow360
By doing this I see the error
Error 1001: Unable to get a response with the specified URL: https://fakedomain.example.com, but it doesn't go to the second link.
How can I solve this problem? With a timer?
I have never used them and I wouldn't know how to set them and position them inside the blocks already created.
Thanks to anyone who can help me.
What is the Web2.Url in the beginning? Is it probably empty?
exactly, so in Screen.Initialize it is still empty (1)
and later (2) it will be set
so you have to move the GoToUrl block into the Web.GotText event after setting the url
What exactly happens if that link is not working? Probably the Screen.ErrorOccured event gets triggered?
But you first use the web component to check. If the link is fine... so what happens, if this is not the case? And only use the GoToUrl block
after you found out, that the link is fine
You might want to provide an updated screenshot of your relevant blocks
Have tried using this webviewer block ?
You forgot to
Also try the Screen.ErrorOccurred event
Here's the block again,
I set the control as you asked and the same error that I already wrote previously always comes out:
Error 1001: Unable to get a response with the specified URL: https://fakedomain.example.com
[Screenshot 2024-02-12 181640]
If response code is not equal to 200 then you are doing nothing here. Call
check procedure here again.
This whole issue has nothing to do with CustomWebView or WebViewer, it's all about wrong logic handling.
call your procedure
Check in the ErrorOccurred event to try the next url
Did you reset the counter to 0 before testing again?
Are there valid links available in your list?
Did you get twice the notification "Link no good"?
post an updated screenshot of your blocks and let us know, which messages you get displayed... you have to find out, which events get triggered...
it might be better to use a label to debug and join the existing label text together with the new message, because the notifier might display messages not in the order you are receiving them
example: just call procedure debug like this in your blocks instead of using the notifier