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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:56:47+00:00 2026-06-11T10:56:47+00:00

I have developed android phonegap app.I am recording the audio through phonegap api and

  • 0

I have developed android phonegap app.I am recording the audio through phonegap api and to move the file i have created a plugin to start media scanner.But media scanner is starting to run after 7 or 8 seconds.So i cannot able to do other process in the app.Is there is any solution to find media scanner is completed or not in android.

Here is my code to start media scanner:

      sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory())));

Here is error in logcat:

 09-17 13:45:36.306: E/AndroidRuntime(706): FATAL EXCEPTION: main
 09-17 13:45:36.306: E/AndroidRuntime(706): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app.example/com.app.example.MainActivity}: java.lang.NullPointerException
 09-17 13:45:36.306: E/AndroidRuntime(706):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
 09-17 13:45:36.306: E/AndroidRuntime(706):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
 09-17 13:45:36.306: E/AndroidRuntime(706):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
 09-17 13:45:36.306: E/AndroidRuntime(706):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
 09-17 13:45:36.306: E/AndroidRuntime(706):     at android.os.Handler.dispatchMessage(Handler.java:99)
 09-17 13:45:36.306: E/AndroidRuntime(706):     at android.os.Looper.loop(Looper.java:123)
 09-17 13:45:36.306: E/AndroidRuntime(706):     at android.app.ActivityThread.main(ActivityThread.java:4627)
 09-17 13:45:36.306: E/AndroidRuntime(706):     at java.lang.reflect.Method.invokeNative(Native Method)
 09-17 13:45:36.306: E/AndroidRuntime(706):     at java.lang.reflect.Method.invoke(Method.java:521)
 09-17 13:45:36.306: E/AndroidRuntime(706):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
 09-17 13:45:36.306: E/AndroidRuntime(706):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
 09-17 13:45:36.306: E/AndroidRuntime(706):     at dalvik.system.NativeStart.main(Native Method)
 09-17 13:45:36.306: E/AndroidRuntime(706): Caused by: java.lang.NullPointerException
 09-17 13:45:36.306: E/AndroidRuntime(706):     at android.content.ContentResolver.registerContentObserver(ContentResolver.java:804)
 09-17 13:45:36.306: E/AndroidRuntime(706):     at com.app.mobilyzer.MobilyzerActivity.isMediaScannerScanning(MobilyzerActivity.java:79)
 09-17 13:45:36.306: E/AndroidRuntime(706):     at com.app.example.MainActivity.onCreate(MainActivity.java:72)
  09-17 13:45:36.306: E/AndroidRuntime(706):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
 09-17 13:45:36.306: E/AndroidRuntime(706):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
 09-17 13:45:36.306: E/AndroidRuntime(706):     ... 11 more

I need to show the progress bar until media scanner completed.Please kindly help me.Thanks In Advance.

  • 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-11T10:56:48+00:00Added an answer on June 11, 2026 at 10:56 am

    Use below code to check if MediaScanner is running

     public static boolean isMediaScannerScanning(ContentResolver cr) {
            boolean result = false;
            Cursor cursor = query(cr, MediaStore.getMediaScannerUri(),
                   new String [] {MediaStore.MEDIA_SCANNER_VOLUME},
                    null, null, null);
            if (cursor != null) {
                if (cursor.getCount() == 1) {
                    cursor.moveToFirst();
                    result = "external".equals(cursor.getString(0));
                }
                cursor.close();
            }    
            return result;
        }
    

    If you need a callback You could register for a content observer on MediaStore.getMediaScannerUri() . But when MediaScanner is going on you could receive too many changes on content observer.

    getContentResolver().registerContentObserver( MediaStore.getMediaScannerUri(), false, contentobserver);
    

    You will have to convert this to Phonegap code i guess.

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

Sidebar

Related Questions

I have developed android phonegap app.I have a appended the dynamic form contains 'input'
I have developed android phonegap app using html and jquery.I need to show tooltip
i have developed an app, running on iphone and android, using phonegap and jquery
I have developed an android service. Any android app can use it's API's to
I have developed phonegap android app.I have been running the app in background when
I have a Android App I have developed, It has been created from a
I have developed the android phonegap application using html page and css. But My
I have developed a android application using phonegap. I have registered certain recievers which
I have developed and android Application and export as APK file to publish this
I have developed my app in android 2.2, and put it on google market

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.