CloudDBError: java.net.UnknownHostException: Host is unresolved: clouddb.appinventor.mit.edu

I have created an app using CloudDB. I noticed that when there is no internet, I am getting following error

CloudDBError: java.net.UnknownHostException: Host is unresolved: clouddb.appinventor.mit.edu

To prevent this error I used the CloudDB.ErrorOccured and it worked in companion. But when I built the app, I am getting the error message.

I notice that it usually happens when there is no internet. Is there any way to prevent this error? When this error occur, the only way out is to switch on the internet or uninstall the app. Because it is a toast message and it keep appearing until the internet is on.

Thanks in advance

There is a classic American vaudeville routine that is something like this.
Patient: Doctor, when I do this with my arm, it hurts.
Doctor: That is easy, to fix. Don't do that!

It always works.

Consider:

  1. Check for an Internet connection. (Try Sajal's advice https://imagnity.com/tutorials/app-inventor/check-internet-connection-in-app-inventor/ ) or use CloudConnected() , it returns true if we are on the network and will likely be able to connect to the CloudDB server. (described in CloudDB If there is a connection, do your operation; if not, do not allow the operation.

  2. You might also benefit by also using Screen1.ErrorOccured ; that might trap the error.

Thank you :slightly_smiling_face:, I have used the Net Extension and it gives the message which I have set. But after the set message is shown, it will give me the CloudDB error I mentioned before.

I will try this method.

Also try check for a connection like this:

if CloudConnected = true then do your CloudDB activity.

I have already done that method but it is not working.

The problem also exist when there is no CloudDB activity.

Thank you @SteveJG for responding quickly, Based on your idea, I used an alternate solution to solve the problem. This is what I did-

  1. I added another screen where there is no CloudDB to avoid toast errors.
  2. Then I added the Net Extension (Thank you @vknow360 for the extension) to check the network connectivity.
  3. I added the OnDissconnect block and redirected to the new screen with start value as the current screen name.
  4. And in the new screen I added the OnConnect block and used the open another screen with the screenName as the start value.

When the network is gone it will automatically go to the new screen. When network is back, it will come to the original screen automatically. So, the problem is solved

Thank you :slightly_smiling_face:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.