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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:45:18+00:00 2026-06-15T02:45:18+00:00

I am trying to create a pop up window when a usb mass storage

  • 0

I am trying to create a pop up window when a usb mass storage device is connected to the device. I am trying with ACTION_MEDIA_MOUNTED . I am able to see that ACTION_MEDIA_MOUNTED is coming through the logs but my app does not pop up.
Here is my code.
Thanks in advance…

MemStickReciever.class

public class MemStickReciever extends BroadcastReceiver {
public final String TAG = "usbfile";
@Override
public void onReceive(Context context, Intent intent) {
    if (intent.getAction().equals(intent.ACTION_MEDIA_MOUNTED))
         {

        Log.d(TAG,"USB MOUNTED (1)");
        Intent intentLaunch = new Intent(context,FileExplore.class);
        Log.d(TAG,"intent has been created ");
        context.startActivity(intentLaunch);
        Log.d(TAG,"intent launched ");
    }

}

FileExplore.class

    public class FileExplore extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
}
}

Manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.mburman.fileexplore"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-feature android:name="android.hardware.usb.host" />
    <uses-sdk android:minSdkVersion="12" />

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".FileExplore"
                  android:label="@string/app_name">
              <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            </activity>
        <receiver android:enabled="true" android:exported="true" android:name="MemStickReciever"> 
        <intent-filter> 
             <action android:name="android.intent.action.MEDIA_MOUNTED"/>
            </intent-filter> 
    </receiver>
    </application>
</manifest>

log files

D/dalvikvm( 1552): GC_CONCURRENT freed 674K, 13% free 9676K/11015K, paused 1ms+3ms
D/Vold    ( 1504): Volume usb state changing 0 (No-Media) -> 2 (Pending)
D/Vold    ( 1504): Volume usb state changing 2 (Pending) -> 1 (Idle-Unmounted)
D/VoldCmdListener( 1504): volume mount /mnt/USB
I/Vold    ( 1504): /dev/block/vold/8:17 being considered for volume usb
D/Vold    ( 1504): Volume usb state changing 1 (Idle-Unmounted) -> 3 (Checking)
D/MountService( 1552): volume state changed for /mnt/USB (bad_removal -> checking)
I//system/bin/fsck_msdos( 1504): ** /dev/block/vold/8:17
D/MountService( 1552): sendStorageIntent Intent { act=android.intent.action.MEDIA_CHECKING dat=file:///mnt/USB (has extras) }
I//system/bin/fsck_msdos( 1504): ** Phase 1 - Read and Compare FATs
I//system/bin/fsck_msdos( 1504): Attempting to allocate 120 KB for FAT
I//system/bin/fsck_msdos( 1504): Attempting to allocate 120 KB for FAT
I//system/bin/fsck_msdos( 1504): ** Phase 2 - Check Cluster Chains
I//system/bin/fsck_msdos( 1504): ** Phase 3 - Checking Directories
I//system/bin/fsck_msdos( 1504): ** Phase 4 - Checking for Lost Files
I//system/bin/fsck_msdos( 1504): 22 files, 207512 free (25939 clusters)
I/Vold    ( 1504): Filesystem check completed OK
I/Vold    ( 1504): Device /dev/block/vold/8:17, target /mnt/USB mounted @ /mnt/secure/staging
D/Vold    ( 1504): Volume usb state changing 3 (Checking) -> 4 (Mounted)
D/MountService( 1552): volume state changed for /mnt/USB (checking -> mounted)
D/MountService( 1552): sendStorageIntent Intent { act=android.intent.action.MEDIA_MOUNTED dat=file:///mnt/USB (has extras) }
D/MediaScannerReceiver( 1969): action: android.intent.action.MEDIA_MOUNTED path: /mnt/USB
I/MediaUploader( 2289): No need to wake up
D/dalvikvm( 1969): GC_CONCURRENT freed 500K, 9% free 6646K/7239K, paused 0ms+1ms
D/MediaStoreImportService( 2419): Handle action: MediaStoreImportService.import_pending
D/MediaStoreImportService( 2419): onDestroy
E/dalvikvm( 1969): No JIT support for bytecode f0 at offsetPC 0
E/dalvikvm( 1969): JIT implementation not found
I/dalvikvm( 1969): codeGenBasicBlockJit returns negative number
D/dalvikvm( 1969): GC_CONCURRENT freed 317K, 8% free 6712K/7239K, paused 1ms+1ms
D/MediaStoreImportService( 2419): Scanner finished. Starting media store import
D/MediaStoreImportService( 2419): Handle action: MediaStoreImportService.import_pending
D/MediaStoreImportService( 2419): Handle action: MediaStoreImportService.import
I/MediaStoreImporter( 2419): Update: incremental Added music: 0 Updated music: 0 Deleted music: 0 Created playlists: 0 Updated playlists: 0 Deleted playlists: 0 Inserted playlist items: 0 Deleted playlist items: 0 Removed orphaned playlist items: 0
D/MediaStoreImportService( 2419): onDestroy
  • 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-15T02:45:19+00:00Added an answer on June 15, 2026 at 2:45 am

    I have just extracted the intent from getExternalStorageState() instead of intent.getAction() and the code works

     public class MemStickReciever extends BroadcastReceiver {
            public final String TAG = "usbfile";
            @Override
            public void onReceive(Context context, Intent intent) {
    
        //As through the logs when the usb mass storage is connected **sendStorageIntent Intent { act=android.intent.action.MEDIA_MOUNTED** was displayed in the log
    
         if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
    
                    onMemcardMounted();
                    Log.d(TAG,"USB MOUNTED (1)");
                    Intent intentLaunch = new Intent(context,FileExplore.class);
                    intentLaunch.addFlags(Intent.FLAG_FROM_BACKGROUND);
                    intentLaunch.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    Log.d(TAG,"intent has been created ");
                    context.startActivity(intentLaunch);
                    Log.d(TAG,"intent launched ");
                }
    
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a button that can pop up the speech input
I'm trying to create a pop up box (with jQuery) that can handle forms,
(Java SE 6) I'm trying to create a pop-up dialog that displays a please
I am trying to create pop up menu using Jquery mobile, by clicking the
Trying to create a facebook app just to learn and coming across a strange
I am a programmer in rails and I am trying to create a pop
I'm trying to create a script that will upload a file to a website.
Im trying to find out a good JavaScript library that can create a nice
I am trying to format some bad html to output into a pop window.
I'm trying to create a clean jquery pop-up with different functionalities. I dont want

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.