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 6214715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:55:35+00:00 2026-05-24T06:55:35+00:00

Im trying to receive BroadcastMessages from CONNECTIVITY_ACTION: // register BroadcastReceiver on network state changes

  • 0

Im trying to receive BroadcastMessages from CONNECTIVITY_ACTION:

    // register BroadcastReceiver on network state changes
    final IntentFilter mIFNetwork = new IntentFilter();
    mIFNetwork.addAction(android.net.ConnectivityManager.CONNECTIVITY_ACTION); //"android.net.conn.CONNECTIVITY_CHANGE"
    registerReceiver(mIRNetwork, mIFNetwork);

and receiver is:

private BroadcastReceiver mIRNetwork = new BroadcastReceiver() {
    @Override
    public void onReceive(final Context context, final Intent intent) {

        android.util.Log.i(TAG,"mIRNetwork: Network State Received: "+intent.getAction());
        Bundle extras = intent.getExtras();
        if (extras!=null){
                android.util.Log.i(TAG,"mIRNetwork: ACTION_BACKGROUND_DATA_SETTING_CHANGED: "+extras.getString(ConnectivityManager.ACTION_BACKGROUND_DATA_SETTING_CHANGED));
                android.util.Log.i(TAG,"mIRNetwork: CONNECTIVITY_ACTION: "+extras.getString(ConnectivityManager.CONNECTIVITY_ACTION));
                android.util.Log.i(TAG,"mIRNetwork: EXTRA_EXTRA_INFO: "+extras.getString(ConnectivityManager.EXTRA_EXTRA_INFO));
                android.util.Log.i(TAG,"mIRNetwork: EXTRA_NO_CONNECTIVITY: "+extras.getString(ConnectivityManager.EXTRA_NO_CONNECTIVITY));
                android.util.Log.i(TAG,"mIRNetwork: EXTRA_REASON: "+extras.getString(ConnectivityManager.EXTRA_REASON));

            }
        }

in short extras is always null. I thought that if i loose WiFi connection i should get EXTRA_NO_CONNECTIVITY (cuz its the only way to Internet) or at least something from the list. But no luck. If i disconnect my WiFi AP receiver gets his message but with null extras. When i turn my WiFi back on once again receiver fires but no extras… Why is that? How to know that app lost any network connection? I thought its the way.

  • 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-05-24T06:55:36+00:00Added an answer on May 24, 2026 at 6:55 am

    You can not get extra but you can get data by this way

    private class ConnectivityBroadcastReceiver extends BroadcastReceiver {
    
        @Override
        public void onReceive(Context context, Intent intent) {
            boolean noConnectivity = intent.getBooleanExtra(ConnectivityManager
                    .EXTRA_NO_CONNECTIVITY, false);
            NetworkInfo info1 = (NetworkInfo) intent.getParcelableExtra(ConnectivityManager
                    .EXTRA_NETWORK_INFO);
            NetworkInfo info2 = (NetworkInfo) intent.getParcelableExtra(ConnectivityManager
                    .EXTRA_OTHER_NETWORK_INFO);
            String reason = intent.getStringExtra(ConnectivityManager.EXTRA_REASON);
            boolean failOver = intent.getBooleanExtra(ConnectivityManager.EXTRA_IS_FAILOVER, false);
            Log.d("MY_TAG", "onReceive(): mNetworkInfo=" + info1 + " mOtherNetworkInfo = " +
                    (info2 == null ? "[none]" : info2 + " noConn=" + noConnectivity));
        }
    }
    

    For more info see this

    http://code.google.com/p/androidwisprclient/source/browse/trunk/src/com/joan/pruebas/NetworkConnectivityListener.java?r=2

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

Sidebar

Related Questions

I'm trying to receive a multicast data from specific network interface on CentOS 5.5
I'm trying to receive some json from my asp.net mvc webservice. ASP.NET: public JsonResult
I am trying to receive a json object back from php after sending data
I am trying to receive an image from the Android Gallery via an ACTION_SEND
I am trying to use Rx to read from a TCPClient receive stream and
I am trying to receive a post array send from the view page by
I'm trying to receive a variable length stream from a camera with python, but
I'm trying to receive some data from a client in a server using Google
I have been trying to receive a data packet from a client however during
I receive an error when trying to get a certificate hash from a remote

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.