On Sun, Oct 31, 2010 at 3:01 PM, longingtoadopt.com <anil.r...@gmail.com>wrote:
> Thanks for your reply... > If you look at the code, I did specify the action in both the Intent > and the Intent filter: ALERT_ME_ACTION > Correct me if I am mistaken but it is intuitive to expect that if the > Actions match then that should be the overriding consideration. It is > analogous to a message or a method call. > If the name of the method matches, then the case "no data" is also > valid and handled by the same method. > Whether or not it is intuitive, this is the way it works. If you want an analogy to a method call, consider this to be overloading. A method call ACTION_SOMETHING with argument "content://foo" is a different method than ACTION_SOMETHING with no argument. > Yes, the data is a Uri > Here is the value I was using: "content://com.iovercomer/alerts/99" > > I meant that in the line > Intent inte = registerReceiver(receiver, new > IntentFilter(ALERT_ME_ACTION)); > > If I am now instead trying to specify > > public IntentFilter (String action, String dataType) > > http://developer.android.com/reference/android/content/IntentFilter.html#IntentFilter%28java.lang.String,%20java.lang.String%29 > > the MIME type is specified as a String. if it is to be lower case, > what would I use to pass in? > If you don't have a MIME type, don't use anything. Let's back up... *why* are you doing this? Unless you need intent resolution to interact with other applications, my first suggestion would be to simply not use it. I also see a red flag in that you are talking about what looks like alarms but using registerReceiver(). Generally you wouldn't use these two together -- the only reason to use an alarm is to allow your application to execute at the time even if it is not currently running. Using registerReceiver() means that your application needs to be actively running with the registration to receive the broadcast. Generally it just doesn't make sense to mix both of these. If you are doing an alarm, usually the PendingIntent you create is an explicit Intent set to the ComponentName of a receiver component declared in your manifest. For that case, you don't need an intent-filter at all, and in fact anything you specify for it will be ignored (since you have already specified the exact component you want to receive it). > Diahn Hackborn mentioned that the data part is used to distinguish > PendingIntents. > Since I am using PendingIntent.FLAG_UPDATE_CURRENT, I want the > PendingIntent associated with > "content://com.iovercomer/alerts/99" to be different from the > PendingIntent for > "content://com.iovercomer/alerts/100" > Hence I am not simply passing it in as an extra in the Bundle. > Explicitly specify the component to receive the intent. Or if you *really* need to have matching done to send to a registerReceiver(), register with an IntentFilter matching scheme "content" and authority "com.iovercomer". But I suspect that is not actually what you want. -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en