How to check internet connection in Sketchware?

To check internet connection in your Sketchware android project, follow the steps given below.

1. In your Sketchware project, add a new RequestNetwork component network.
 2. In onCreate event or in the event when you want to check internet connection, use the block RequestNetwork start network request to method GET to url http://google.com with tag A, as shown in image below.

 3. Add event RequestNetwork onResponse, and here Toast the message "Connected to Internet" or do other things when user is connected.
 4. Add event RequestNetwork onErrorResponse, and here Toast the message "Not Connected to Internet" or do other things when user is not connected.

5. Save and run the project.

Comments

  1. Not working now

    Please help

    ReplyDelete
  2. How can make button for refresh stauts again if change from offline to on line

    ReplyDelete
    Replies
    1. Put the Block "Check" and the "if..else.." block after that, in webview onPageStarted or webview onPageFinished.

      Delete
  3. WebView loadUrl (webview getUrl).

    ReplyDelete
  4. bro give me code that you write your video .make a video that enable full screen on youtube with Internet checker

    ReplyDelete
  5. this code is not working for me please help

    ReplyDelete
  6. It works, nice tutorial. Thanks, Bro

    ReplyDelete
  7. Not working java.io exeptio cannot run program ping error 13 permisio denied how to solve

    ReplyDelete
  8. why make it so complicated? Just use request network

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. How can I open new window when no internet???

    ReplyDelete
  11. It's working with https://google.com instead of http://google.com

    ReplyDelete
  12. it always shows "not connected to the internet".

    ReplyDelete
  13. Sir, can you tell me the code for turning the internet on/off using asd code. Thank you in advance 😊.

    ReplyDelete
  14. Sir, can you tell me the code for turning the internet on/off using asd code. Thank you in advance 😊.

    ReplyDelete
  15. Please help me.. i used this component. My app is linked with firbase. After used this component my app scanner shows "high risk. Malware or virus. Please uninstall" why that

    ReplyDelete
  16. Pls my Sketchware is not signing in, it's showing error when I try to log in to my Google account

    ReplyDelete

Post a Comment

Popular posts from this blog

Simple car racing android game in Sketchware

How to enable upload from webview in Sketchware?

Enable Fullscreen for Youtube videos in WebView

Creating a Drawing View in Sketchware

List of Calendar Format symbols valid in Sketchware