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

  • Home
  • SEARCH
  • 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 7071641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:42:45+00:00 2026-05-28T05:42:45+00:00

I am trying to detect the Turn on USB storage using BroadcastReceiver though i

  • 0

I am trying to detect the Turn on USB storage using BroadcastReceiver though i am able to detect the USB connected using android.intent.action.UMS_CONNECTED action
and
disconnected using android.intent.action.UMS_DISCONNECTED action.

How can i detect the USB storage ?

  • 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-28T05:42:46+00:00Added an answer on May 28, 2026 at 5:42 am

    Below is how I check if storage card is mounted/unmounted. You can change it to check removed/insterted. I do this by register a BroadcastReceiver to get the “mount events” then check what state the storage card is in. If it is not mounted and is not while it is checking (the state during it mounts the card again) it is unmounted or the card has been removed.

    public class MemCardReceiver extends BroadcastReceiver {
    
        @Override
        public void onReceive(Context context, Intent intent) {
            if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
                onMemcardMounted();
            }
            else if (!Environment.getExternalStorageState().equals(Environment.MEDIA_CHECKING)){
                onMemorycardUnMounted();
            }
        }
    
        private void onMemorycardUnMounted() {}
    
        private void onMemcardMounted() {}
    }
    

    And in ManifestFile

    <receiver android:enabled="true" android:exported="true" android:name="the.name"> 
            <intent-filter> 
                <action android:name="android.intent.action.MEDIA_MOUNTED" /> 
                <action android:name="android.intent.action.MEDIA_UNMOUNTED" />
                <data android:scheme="file" /> 
            </intent-filter> 
        </receiver>
    

    There are several different states checkout this if there are any other stated like. removed

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

Sidebar

Related Questions

I am trying to detect a USB disk drive being inserted within a Windows
I'm trying to detect which version .NET is installed using WiX. I've tried: <Condition
I'm trying to detect pinch using multitouch in onTouchEvent of the activity. But the
I am trying detect when a textarea becomes full for creating pagination effect. Using
Trying to detect when a user clicks Cancel but the $_POST on using var_export($_POST)
Trying to detect if files property is supported in DataTransfer Object using Javascript. The
I am trying to detect browser using following code, if ($.browser.msie && parseInt($.browser.version) >=
I'm trying to detect the size of the screen I'm starting emacs on, and
I am trying to detect which web in sharepoint that the user is looking
I'm trying to detect when the onresize event ends in a browser. If I

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.