Hi Nick,

What about on Android 4.0.3 onward? Do we still need set 
up NfcAdapter, PendingIntent and enableForegroundDispatch in every Activity?



在 2011年6月10日星期五UTC+8上午1时15分41秒,Nick Pelly写道:
>
> 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]<javascript:>
> > wrote:
>
>> Hi, Dianne Hackborn
>>
>> Thanks a lot.
>>
>> Ding
>>
>> 2011/6/5 Dianne Hackborn <[email protected] <javascript:>>
>>
>>> Yes do it in every activity.
>>>
>>>
>>> On Fri, Jun 3, 2011 at 2:02 AM, Xiaoliang Ding 
>>> <[email protected]<javascript:>
>>> > 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] <javascript:>>
>>>>
>>>>> 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]<javascript:>
>>>>> > 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]<javascript:>
>>>>>> To unsubscribe from this group, send email to
>>>>>> [email protected] <javascript:>
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/android-developers?hl=en
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> Dianne Hackborn
>>>>> Android framework engineer
>>>>> [email protected] <javascript:>
>>>>>
>>>>> 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]<javascript:>
>>>>> To unsubscribe from this group, send email to
>>>>> [email protected] <javascript:>
>>>>> 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]<javascript:>
>>>> To unsubscribe from this group, send email to
>>>> [email protected] <javascript:>
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/android-developers?hl=en
>>>>
>>>
>>>
>>>
>>> -- 
>>> Dianne Hackborn
>>> Android framework engineer
>>> [email protected] <javascript:>
>>>
>>> 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]<javascript:>
>>> To unsubscribe from this group, send email to
>>> [email protected] <javascript:>
>>> 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]<javascript:>
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> 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

Reply via email to