Hi Xiaoliang, We know this is a little annoying, we are thinking about some improvements for future Android releases, so that you only need to enable foreground dispatch for all activities in an application, and not for every activity.
For now you have to enable it in every activity. Cheers, Nick On Mon, Jun 6, 2011 at 6:43 PM, Xiaoliang Ding <[email protected]> wrote: > Hi, Dianne Hackborn > > Thanks a lot. > > Ding > > 2011/6/5 Dianne Hackborn <[email protected]> > >> Yes do it in every activity. >> >> >> On Fri, Jun 3, 2011 at 2:02 AM, Xiaoliang Ding <[email protected]>wrote: >> >>> Hi, Dianne Hackborn >>> >>> You mean I need call NfcAdapter.enableForegroundDispatch in every >>> activity of my app, right? >>> >>> Thanks >>> Ding >>> >>> 2011/6/3 Dianne Hackborn <[email protected]> >>> >>>> You very intentionally can't. This is for you to handle the events when >>>> your UI is actually in the foreground with the user, not to steal them all >>>> the time you happen to be running. If you want to do this in multiple >>>> activities, you can organize your code to share that common implementation >>>> between them but each must enable dispatching while it is in the >>>> foreground. >>>> >>>> On Fri, Jun 3, 2011 at 12:22 AM, Xiaoliang Ding <[email protected]>wrote: >>>> >>>>> hi, I am writing a NFC application. I use the >>>>> NfcAdapter.enableForegroundDispatch in an activity to make sure a NFC tag >>>>> detected event routing to this activity direct, not show other >>>>> applications >>>>> which has capability to resolve this event. My question is when my >>>>> application is running, how to make sure the tag detected event routing >>>>> this >>>>> activity direct even though this activity is inactive, because the >>>>> application has three activities. >>>>> >>>>> >>>>> Thanks >>>>> Ding >>>>> >>>>> -- >>>>> 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 >>>> >>>> >>>> >>>> >>>> -- >>>> Dianne Hackborn >>>> Android framework engineer >>>> [email protected] >>>> >>>> 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 >>>> [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 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 >>> >> >> >> >> -- >> Dianne Hackborn >> Android framework engineer >> [email protected] >> >> 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 [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 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 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

