SEQUENTIAL bidirectional P2P with NFC on Gingerbread

314 views
Skip to first unread message

Tez

unread,
Sep 20, 2011, 11:53:32 AM9/20/11
to android-platform
I have the following scenario

1. Phone A prepares an NDEF message and Phone B registers foreground
dispatch.
2. Phone A pushes the NDEF. Phone B receives this and processes it.
3. Phone A now registers for foreground dispatch and disables NDEF
push.Phone B replies with an NDEF push.

ALL this is to be done in one swipe. How can I do this?
Right now, I have to pull the devices away for the 2nd part to work. I
have seen the sample on p2p exchange, but in that case, both the
message contents are known in advance. Here, the reply depends on the
request.

Secondly, will there be a proper NFC API with the ability to create
LLCP sockets?

Cheers,
Earlence

Tez

unread,
Sep 21, 2011, 12:07:26 PM9/21/11
to android-platform
Basically, I need a request-response mechanism in one swipe.
from the logs, I see that the system is "about to close" an LLCP
connection, but does not do so until the 2 devices are out of each
others RF fields.
Due to this, the polling loop does not restart to make the system
available for another NDEF push.

Is there anything that can be done, short of modifying the system
code?

-Earlence

Alexander Starchenko

unread,
Sep 22, 2011, 9:11:12 AM9/22/11
to android-...@googlegroups.com
Check out this:
1. Tutorial to make hidden API visible devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-introduction/

2. Use INfcAdapter, ILlcpServiceSocket, ILlcpSocket (will be visible after 1 step) like it's done in the code from com.android.nfc.ndefpush package;

Yes, it's quite 'dirty' way, but the only possible currently on 2.3.4 version.

Alexander Starchenko

unread,
Sep 22, 2011, 5:20:51 AM9/22/11
to android-platform
Take a look:
1. devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-
introduction/;
2. INfcAdapter, ILlcpServicesocket, ILlcpSocket classes (following 1.
would give You access to these classes);

It's possible to make LLCP P2P communication on two 2.3.4 device.

I know, this is a 'dirty' way, but there seems to be no other option
to achieve what You're looking for.

Thanks in advance,
Alex

Tez

unread,
Sep 22, 2011, 1:48:50 PM9/22/11
to android-platform
Hmm...this is interesting.

I was also thinking the following:
Suppose I use internal and hidden APIs in a package that is compiled
with the entire Android System itself.
I guess this method should also work.

-Earlence

On Sep 22, 11:20 am, Alexander Starchenko <alex.starche...@gmail.com>
wrote:

d

unread,
Oct 24, 2011, 6:13:05 PM10/24/11
to android-platform
Hi Earlence,

I am also trying to do the same scenario on 2.3.6.
I tried using Alex's solution but the API has been updated so some of
the classes/methods are missing.
Could you please post the solution if you got it.

Thanks!
> > > > Secondly, will there be a properNFCAPI with the ability to create
> > > > LLCP sockets?
>
> > > > Cheers,
> > > > Earlence

Nick Pelly

unread,
Oct 26, 2011, 1:36:03 AM10/26/11
to android-...@googlegroups.com
We don't currently provide a way to do command/response over P2P. We understand the use cases, and want to make these use cases possible in a clean and future-proof way at some time.

Those (hidden) API's are no longer present in ICS.

Nick



--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To view this discussion on the web visit https://groups.google.com/d/msg/android-platform/-/IYy7_RGBT90J.

To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.

Tez

unread,
Oct 26, 2011, 3:01:20 PM10/26/11
to android-platform
> understand the use cases, and want to make these use cases possible in a
> clean and future-proof way at some time.

Is there any ETA on this? eg: in the next, or within the next 2
releases?

> Could you please post the solution if you got it.

Yes, I managed to do it on the gingerbread stock version.
However, it is quite unstable.

Basically, you have to listen for the LLCP system notifications and
piggy back on them.
I will post a link to the code soon.

-Earlence

d

unread,
Oct 31, 2011, 4:52:17 PM10/31/11
to android-platform
Thanks Earlence!
I am still working on it, would be great if you can share it.

Michael Roland

unread,
Jan 9, 2013, 7:16:43 AM1/9/13
to android-...@googlegroups.com, Sam Van Den Berge
Hi Sam,

there is still no API for bidirectional P2P communication. However, you
might want to have a look at these two projects:

http://code.google.com/p/ismb-npp-java/
http://code.google.com/p/ismb-snep-java/

They do kind-of bidirectional P2P communication over SNEP/NPP. However,
they exchange one message per connection instead of keeping one
continuous connection.

br,
Michael


On 2012-12-02 13:34, Sam Van Den Berge wrote:
> Is there any recent news concerning this subject? At the moment I'm
> doing a thesis which is related to this subject.
> Is it correct that sending a response withing a single connection is
> still not supported in Jelly Bean?
>
> Sam.
>
> Op woensdag 26 oktober 2011 07:36:03 UTC+2 schreef Nick Pelly het volgende:
>
> We don't currently provide a way to do command/response over P2P. We
> understand the use cases, and want to make these use cases possible
> in a clean and future-proof way at some time.
>
> Those (hidden) API's are no longer present in ICS.
>
> Nick
>
>
>
> On Thu, Sep 22, 2011 at 6:11 AM, Alexander Starchenko
> <alex.st...@gmail.com <javascript:>> wrote:
>
> Check out this:
> 1. Tutorial to make hidden API visible
> devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-introduction/
> <http://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-introduction/>
>
> 2. Use INfcAdapter, ILlcpServiceSocket, ILlcpSocket (will be
> visible after 1 step) like it's done in the code from
> com.android.nfc.ndefpush package;
>
> Yes, it's quite 'dirty' way, but the only possible currently on
> 2.3.4 version.
>
> --
> You received this message because you are subscribed to the
> Google Groups "android-platform" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/android-platform/-/IYy7_RGBT90J
> <https://groups.google.com/d/msg/android-platform/-/IYy7_RGBT90J>.
>
> To post to this group, send email to
> android-...@googlegroups.com <javascript:>.
> To unsubscribe from this group, send email to
> android-platfo...@googlegroups.com <javascript:>.
> For more options, visit this group at
> http://groups.google.com/group/android-platform?hl=en
> <http://groups.google.com/group/android-platform?hl=en>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "android-platform" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/android-platform/-/R6xK0DCrhlAJ.
Reply all
Reply to author
Forward
0 new messages