Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9189399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:13:41+00:00 2026-06-17T20:13:41+00:00

I done an app that uses a webview to listen audio from internet. Now,

  • 0

I done an app that uses a webview to listen audio from internet. Now, I add a method (isOnline) to check if there’s (or not) an internet activity. I’ve a doubt: I can use this method running always in OnCreate?

public boolean isOnline() {
        ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo netInfo = cm.getActiveNetworkInfo();
        if (netInfo != null && netInfo.isConnectedOrConnecting()) {
            return true;
        }
        return false;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:13:42+00:00Added an answer on June 17, 2026 at 8:13 pm

    If you block the execution of the onCreate() aka the UI thread will be blocked and your app will throw ANR (Application Not Responding) exception.

    However your method doesn’t tell you that you are connected to the interned, it just tell you that your device isConnectedOrConnecting to nearest router. What is after that you don’t know.

    For check real internet connection you need to make a request to a server, such as http://www.google.com and if you get the answer then you have the connection live.

    And another thing, you don’t need to monitor your connection continuously. In the most simple manner you can do this in a background thread from time to time, but only if you cannot get events from your radio player.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i've done an android app that retrieves data from the interent , format it
I'm implementing a search feature for an app that uses entity framework. There are
I have WP7 app that uses the MVVM pattern. When the user goes from
I have an ASP.NET app that uses a SQL Server database. I now need
We developing a iOS app that uses CoreData. To keep ourselves from going crazy
I'm trying to write an app that uses TCP/IP to communicate to and from
I have a class that extends android.app.Dialog, the layout is done in an xml
I'm making a mobile app using phonegap. That is to say, it's all done
I have an app that uses core data. The app is free for download
I'm making an app that uses the full screen to display an image like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.