How to check if sendBroadcast has finished his job

Put your problem here if it does not fit any of the other categories.

How to check if sendBroadcast has finished his job

Postby Stigi » Mon Mar 19, 2012 3:52 am

Hello,
I got little problem. I'm refreshing my sdcard using:
Code: Select all
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"+Environment.getExternalStorageDirectory())));

and I would like to create ProgressDialog with a spinner which pops out at the start and after successful refresh to dismiss it, but I got no idea how to check that MediaScanner finished his job. I tried using BroadcastReciver and sendStickyOrderedBroadcast(...), but its seems it was wrong idea...
I can't use MediaScannerConnection and OnScanCompletedListener() because I don't have direct paths to the files (in some situations, it doesn't exist).
Does anyone have any idea how to solve my problem? I have run out of ideas :'(

Thanks in advance,
Stigi
Stigi
Freshman
Freshman
 
Posts: 2
Joined: Mon Mar 19, 2012 3:34 am

Top

Re: How to check if sendBroadcast has finished his job

Postby Phyll » Thu Mar 22, 2012 9:44 pm

Hi stigi,

I'm not sure what you are doing exactly. Are you just trying to determine if you sdcard is still mounted?

Trying to mount it after it has been removed?

I guess I don't know exactly what you mean by "refresh the sdcard".

Hoping to be of help.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: How to check if sendBroadcast has finished his job

Postby Stigi » Sat Mar 24, 2012 9:14 pm

Nope its not what I mean. When I'm using this:
Code: Select all
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"+Environment.getExternalStorageDirectory())));

My sdcard is refreshed - by refresh i mean that all the new data that was copied np: mp3/photos etc will be seen in music software/gallery etc (when u copy mp3 from PC to sdcard while ur phone is ON, music software wont see this mp3, thats why I have to refresh sdcard).
When I'm using code i mentioned before, it sends info to my system that sdcard have to be refreshed, and now my problem is: how to check that system finished his job (I'm not sure, but i think that MediaScanner refreshes this data, i tried few things that might check if it finished refreshing, but it wasn't working...)

i hope it clarify my problem a bit I'm not native speaker and its kind of hard to explain it in english, sorry about that.
Stigi
Freshman
Freshman
 
Posts: 2
Joined: Mon Mar 19, 2012 3:34 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 16 guests