*Hi Nick,*
*
*
*Your code only work for tag. What about the phone detection? Is there a 
way to detect the NFC phone in or lost the field?*

在 2011年8月3日星期三UTC+8上午12时46分33秒,android user写道:
>
> Hello David, 
> Here is some code 
> try { 
>                 tag.connect(); 
>                         if(tag.isConnected() && tag.isWritable()){ 
>                                 tag.writeNdefMessage(message); 
>                                 tag.close(); 
>                         } 
>
>                 } catch (IOException e) { 
>                         // TODO Auto-generated catch block 
>
>                 } catch (FormatException e) { 
>                         // TODO Auto-generated catch block 
>
>                 } 
> This code works for writing. I also have a problem how to detect a tag 
> is lost. Although this code works but it can not stop on catch 
> statment and therefore i can not implement a code if the tag is lost. 
> john 
>
> On Aug 1, 11:47 pm, David P <[email protected]> wrote: 
> > Hey Nick, 
> > 
> > Could you please provide a code example of how to signal an event when 
> > a "tag is lost"? Thanks in advance. 
> > 
> > Best Regards, 
> > David 
> > 
> > On Jun 9, 10:18 am, Nick Pelly <[email protected]> wrote: 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > As per other responses, you currently need to poll isConnected() on a 
> > > connected technology object. 
> > 
> > > This is not ideal, and we are considering an intent or callback in a 
> future 
> > > API version. 
> > 
> > > Cheers, 
> > > Nick 
> > 
> > > On Wed, Jun 1, 2011 at 8:47 PM, Dean Brotzel <[email protected]> 
> wrote: 
> > > > Is it possible to receive a message/intent from Android for when a 
> tag is 
> > > > removed from the smart phone's influence (much like when a tag is 
> brought 
> > > > into to the smart phone's influence) ? 
> > 
> > > > I noticed from logcat the following log message:  "D/NativeNfcTag( 
> 3625): 
> > > > Tag lost, restarting polling loop", when I remove theNFCtag.  Is 
> there 
> > > > a programmatic way to catch this event?  I've looked through the API 
> and 
> > > > don't anything obvious.  I'm using the Nexus S,  android 2.3.4. 
> > 
> > > > I hope I don't have to implement my own detection/presence polling. 
> > 
> > > > Thanks, 
> > > > Dean 
> > 
> > > > -- 
> > > > 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

Reply via email to