11-19-2012 01:20 AM
Hi fellow BB10 Developers and fans,
I would like to share small amounts of data (less than 100 bytes) from one device to another via NFC, and it looks like "NfcShareManager" is designed to easily do so!
Sharing URLs to the recipient's browser works fine:
NfcShareDataContent c; c.setUri(QUrl("http://blackberry10.com")); _nfcManager->setShareContent(c); _nfcManager->setShareMode(NfcShareMode::Data);
So I tried to invoke my application...
// app.cpp: NfcShareDataContent c; c.setMimeType("application/myapp"); c.setData(QString("I am a QString").toUtf8()); _nfcManager->setShareContent(c); _nfcManager->setShareMode(NfcShareMode::Data);
<!-- bar-descriptor.xml --> <invoke-target id="com.mycompany.appname.invoke"> <type>application</type> <filter> <action>bb.action.OPEN</action> <mime-type>application/myapp</mime-type> </filter> </invoke-target>
When I press two Dev Alpha B's together, they both vibrate. The "sender" makes the positive NFC chime, and the receiver makes the unsuccessful NFC "uh-uh" sound. I get the following message on the "receiver":
"Your NFC applications do not recognize this content"
Do I need to add more <action>s to my bar-descriptor.xml? Perhaps another mime-type? I am testing with OS version 10.0.9.386. Thanks in advance!