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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:12:05+00:00 2026-05-21T09:12:05+00:00

I have the following setup: SD card Mount Receiver (MountReceiver.java) public IntentFilter getIntentFilter() {

  • 0

I have the following setup:

SD card Mount Receiver (MountReceiver.java)

public IntentFilter getIntentFilter() {
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(Intent.ACTION_MEDIA_MOUNTED);
    intentFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
    intentFilter.addDataScheme("file");
    return intentFilter;
}

@Override
public void onReceive(Context context, Intent intent) {
    String action = intent.getAction();
    if (Intent.ACTION_MEDIA_MOUNTED.equals(action)) {
        setMounted(true);
    } else if (Intent.ACTION_MEDIA_UNMOUNTED.equals(action)) {
        setMounted(false);
    }
}

private void setMounted(boolean isMounted) {
    if (isMounted) {
        doPerformQuery();
    }
}

And when I register the receiver, I do:

registerReceiver(mountInstance, mountInstance.getIntentFilter());

Everything is fine and dandy and working as expected. I can unmount and remount my SD card and my setMounted method is fired as appropriate. The problem I have is, is that my doPerformQuery() method returns 0 results after the SD card is mounted. If I change the code to:

Thread.sleep(5000);
doPerformQuery();

Then it will work, occasionally. This gives the SD card 5 seconds to finish “preparing”. I want to know when the SD card has finished preparing and can be read. Currently, I’m getting the intent when the SD card is mounted, but it hasn’t “prepared” itself yet, so it’s not readable. Is there such an intent to register to when the SD card has finished “preparing”. On a side note, I say “preparing” because that’s what my phone says in the notification bar. I’m not sure if this is standard across all phones as I can’t find a single thing about the SD card preparing online.

  • 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-21T09:12:05+00:00Added an answer on May 21, 2026 at 9:12 am

    In response to our comments to your original question…

    I think the logic is that when the SD card is dismounted, the content provider for various AV media (videos, music, photos etc) is cleared of anything on the SD card because the system won’t know when (if ever) the same SD card will return and if it does whether it will have the same files on it. As a result, a full scan is carried out each time an SD card is installed (resulting in the ‘preparing’ notification).

    So in your case, checking for ACTION_MEDIA_SCANNER_STARTED and most importantly the associated ACTION_MEDIA_SCANNER_FINISHED means the AV media content provider will have a current list of everything on the card.

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

Sidebar

Related Questions

No related questions found

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.