On Mon, Aug 20, 2012 at 8:55 PM, Zoltán Páll <[email protected]> wrote: > Hello, > > > There are many topics that describe how to work with tags, but I'm trying to > only detect when another phone was put close to mine, even if it's not > sending anything. Just switched on screen and tapped to mine. The system > plays some sound, so it's somehow hooked somewhere, but I can't get an > intent in my app. > >
There is no reliable way to do this. What are you trying do do? A 'phone' can be anything: it can act as a card/tag if it is in card emulation mode, or it can be sending you data in P2P mode. It can even be acting as a reader and trying to read *your* device. Generally, the Android NFC APIs are fairly high level, so you can't really do whatever you want. You have to stick to the higher level abstractions: reading a tag, NDEF push, Android Beam, etc. > > My app gets an intent when scanning a chip, but when putting another phone > close, it only plays the sound (as if it failed, or as if it didn't have an > app to handle the intent). Any idea how to do this? All I need is the event > when someone puts an NFC chip/device in range. It tries to start P2P and fails, hence the sound. TAG_DISCOVERED should work as a general event, but for phones it will only work (maybe) if the device is in card emulation mode. And, AFAIK, you can really disable the built-in P2P logic (disabling Android Beam from Settings doesn't seem to do it), but I haven't really looked into this. -- 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

