The problem I have is that I cannot seem to catch android.intent.action.MEDIA_MOUNTED via a dynamically-registered receiver. I can only catch it if I enter the receiver in the manifest. I don't want to do this. I want to catch it in code because I want to be able to set a few variables that my application can later query. If I catch it statically I have no idea how Android creates an "instance" of the BroadcastReceiver much less how to access it later on via code.
On Wednesday, May 29, 2013 12:13:47 AM UTC-7, Piren wrote: > > It's not a question of "must" ... it's a question of choice and > availability. Some events can be registered in the manifest can also be > registered in code (but not all events that can be registered in code can > be registered in the manifest) and have the added benefit of being sent to > your app even if it wasn't started (as long as it was started at least once > and wasn't force closed since the last restart) > > Regarding the list, it doesn't exist... google suck in that aspect. I'm > not even sure there's even a list of all existing events (both code and > manifest based). > > On Tuesday, May 28, 2013 10:59:59 PM UTC+3, gonzobrains wrote: >> >> Why must some broadcasts be registered in code while others must be >> registered in a manifest file? Is there somewhere that lists registration >> requirements for every broadcast? >> >> On Thursday, October 28, 2010 8:53:37 AM UTC-7, Streets Of Boston wrote: >>> >>> You'd have to register your broadcaster in your code: >>> >>> http://groups.google.com/group/android-developers/browse_frm/thread/c2a91e60bff34028/a6bf11c05641a909?lnk=gst&q=MEDIA_MOUNTED# >>> >>> >>> >>> On Oct 28, 4:53 am, Karteek N <[email protected]> wrote: >>> > How to cath android.intent.action.MEDIA_MOUNTED event >>> > I implemented an broadcast receiver to invoke when sdcard is mounted. >>> > But it is not invoked >>> > My source code is as follows >>> > MyMediaMountListener.java >>> > >>> > public class MyMediaMountListener extends BroadcastReceiver { >>> > >>> > @Override >>> > public void onReceive(Context context, Intent intent) { >>> > Log.d("", "Media mounted"); >>> > } >>> > >>> > } >>> > >>> > AndroidManifest.xml >>> > >>> > <application android:icon="@drawable/icon" >>> android:label="@string/app_name"> >>> > <activity android:name=".BackupActivity" >>> > 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:name="MyMediaMountListener"> >>> > <intent-filter> >>> > <action >>> > android:name="android.intent.action.MEDIA_MOUNTED"></action> >>> > </intent-filter> >>> > >>> > </receiver> >>> > </application> >>> > >>> > Any help please >>> > karteek >> >> -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

