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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:57:16+00:00 2026-06-04T13:57:16+00:00

I have an app which updates the database whenever the phone is connected to

  • 0

I have an app which updates the database whenever the phone is connected to WiFi. I have implemented a Service and BroadcastReceiver which will run the Service (it will tell me what network is in use), but the problem is I don’t know what to add in the manifest file to start BroadcastReceiver when the network state changes or when it connects to some kind of network

  • 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-04T13:57:18+00:00Added an answer on June 4, 2026 at 1:57 pm

    You need

    <intent-filter>
    <action android:name="android.net.wifi.WIFI_STATE_CHANGED"/>
    <action android:name="android.net.wifi.STATE_CHANGE"/>
    </intent-filter>
    

    In your receiver tag.

    Or if you want more control over it, before registering BroadcastReceiver set these up:

    final IntentFilter filters = new IntentFilter();
    filters.addAction("android.net.wifi.WIFI_STATE_CHANGED");
    filters.addAction("android.net.wifi.STATE_CHANGE");
    super.registerReceiver(yourReceiver, filters);
    

    WIFI_STATE_CHANGED

    Broadcast <intent-action> indicating that Wi-Fi has been enabled, disabled, enabling, disabling, or unknown. One extra provides this state as an int. Another extra provides the previous state, if available.

    STATE_CHANGE

    Broadcast <intent-action> indicating that the state of Wi-Fi connectivity has changed. One extra provides the new state in the form of a NetworkInfo object. If the new state is CONNECTED, additional extras may provide the BSSID and WifiInfo of the access point. as a String

    Also, you’ll need to specify the right permissions inside manifest tag:

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    

    To check connectivity, you can use ConnectivityManager as it tells you what type of connection is available.

    ConnectivityManager conMngr = (ConnectivityManager)this.getSystemService(this.CONNECTIVITY_SERVICE);
    android.net.NetworkInfo wifi = conMngr.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
    android.net.NetworkInfo mobile = conMngr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Swing runnable app which updates messages, then I have a Java
I have a problem regarding android database.I have an app which have it's database
I have a rails 3 app which uses resque to run long running jobs
I have published my app on google play which uses database. Now what I
I have an app on the Store for which we’re readying an update. The
I have a little Updater in my mac app, which automatically downloads a dmg-file
I have app in which i have recorded sound files i want that i
I have an app which uses a keyboard hook procedure in a library. The
I have an app which is quite huge. It has tons of images and
I have an app which acts almost like a daemon. Sometimes it quits on

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.