Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
komanaki
Posts: 22
Registered: ‎03-07-2012
My Device: PlayBook, Dev Alpha

Re: NFC permission?

I saw you just released a complete article about NFC SNEP, this is too fast ! :smileysurprised:

Thanks a lot.

____________________________________
BB10 developer thanks to the PlayBook offer.
Waiting for my Z10 LE now !
Retired
mwoolley
Posts: 571
Registered: ‎06-25-2010
My Device: Z10

Re: NFC permission?

we aim to please :-)

 

And there will be more!

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Contributor
komanaki
Posts: 22
Registered: ‎03-07-2012
My Device: PlayBook, Dev Alpha

Re: NFC permission?

Cool :smileyhappy:

But i noticed that the "Read mode" in NFC Tool can't detect the SNEP mode :/

____________________________________
BB10 developer thanks to the PlayBook offer.
Waiting for my Z10 LE now !
Retired
mwoolley
Posts: 571
Registered: ‎06-25-2010
My Device: Z10

Re: NFC permission?

Let me check I understand what you mean; are you trying to use the NFC Tool "Read tag" function to receive an NDEF message sent over SNEP?

If so, be aware that the Read function registers as a listener for types T, U and Sp only so unless your SNEP responder serves an NDEF message of one of those types, the NFC Tool will not respond. I just tested, sending a type T (text) message from a 9900 and it worked fine.
--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Contributor
komanaki
Posts: 22
Registered: ‎03-07-2012
My Device: PlayBook, Dev Alpha

Re: NFC permission?

Okay, so i have to tweak the code of the SNEP part in order to send a T, U or Sp message ?

____________________________________
BB10 developer thanks to the PlayBook offer.
Waiting for my Z10 LE now !
Retired
mwoolley
Posts: 571
Registered: ‎06-25-2010
My Device: Z10

Re: NFC permission?

Yes, a class like the following may help:

 

public class SnepMsgBuilder implements NDEFMessageBuilder {
    
    private String the_text="";
    
    public SnepMsgBuilder(String text) {
        the_text = text;        
    }

    public NDEFMessage[] buildNDEFMessages() {
        NDEFMessage[] ndefMessages = null;
        NDEFMessage textNdefMessage;
        try {
            textNdefMessage = NDEFMessageUtils.createTextNDEFMessage(the_text, "en-US");
            ndefMessages = new NDEFMessage[] { textNdefMessage };
            return ndefMessages;
        } catch(NFCException e) {
            return new NDEFMessage [0];
        }
    }

}

 

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Contributor
komanaki
Posts: 22
Registered: ‎03-07-2012
My Device: PlayBook, Dev Alpha

Re: NFC permission?

I duplicated the "Send vCard (SNEP)" part and tweaked it in order to send a Text record instead of a Media record,

But the other Dev Aplha in "Read" mode don't detect anything...

____________________________________
BB10 developer thanks to the PlayBook offer.
Waiting for my Z10 LE now !
Retired
mwoolley
Posts: 571
Registered: ‎06-25-2010
My Device: Z10

Re: NFC permission?

OK, I see what you're doing now. The read function in Nfc Tool will not receive SNEP messages sent by the same device. You need two devices to play with peer to peer. You can't be both sender and receiver of the same data in the same device.

 

So I used a BlackBerry Bold 9900 as the other device. The Java I pasted was from an app I wrote for BB7 which served an NDEF T messages via SNEP. This was received by the Read function running on the Dev Alpha.

 

Hope that makes sense and you have access to another device which supports NFC peer to peer mode.

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Contributor
komanaki
Posts: 22
Registered: ‎03-07-2012
My Device: PlayBook, Dev Alpha

Re: NFC permission?

I got it, that's why i'm testing that with two Dev Alpha, but the logs says that there's absolutely no BPS events for both sender device and receiver device :/

____________________________________
BB10 developer thanks to the PlayBook offer.
Waiting for my Z10 LE now !
Retired
mwoolley
Posts: 571
Registered: ‎06-25-2010
My Device: Z10

Re: NFC permission?

Ah OK, thanks for clarifying. You have *two* Dev Alphas?! Who do you work for?

 

I'll do some investigation now I understand this.

 

Cheers

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim