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
Developer
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B
My Carrier: BSNL INDIA

Re: Turn On NFC programatically

[ Edited ]

following the advice given by @robbieDubya, this is what I did:

 

added this line to my app's .PRO file

    

LIBS += -lnfc

 

included this in the .hpp file

#include <nfc/nfc.h>

  

 

and this was added to the .cpp file and it worked like a charm

nfc_connect();
nfc_set_setting(NFC_SETTING_ENABLED, true);

 

thanx man.. Smiley Happy

Developer
Posts: 1,632
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

Re: Turn On NFC programatically


SuhairZain wrote:

following the advice given by @robbieDubya, this is what I did:

 

added this line to my app's .PRO file

    

LIBS += -lnfc

 

included this in the .hpp file

#include <nfc/nfc.h>

  

 

and this was added to the .cpp file and it worked like a charm

nfc_connect();
nfc_set_setting(NFC_SETTING_ENABLED, true);

 

thanx man.. Smiley Happy


that is cool but is there a way to turn NFC off?

Highlighted
Developer
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B
My Carrier: BSNL INDIA

Re: Turn On NFC programatically

Nopes.. we can only turn nfc on.. the user will have to manually turn it off.. you could use invocation framework to provide the user with a shortcut to turn off nfc though..