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
SuhairZain
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B
Accepted Solution

Turn On NFC programatically

Hi, is there any way I can turn NFC on without user interaction. The reason is that I want to turn NFC on as soon as my app is started. Any suggestions?
BlackBerry Development Advisor
Kareem_ELSayed
Posts: 81
Registered: ‎09-09-2013
My Device: BlackBerry Z10

Re: Turn On NFC programatically

Hello,

https://developer.blackberry.com/native/reference/core/nfc_libref/topic/nfc_settings_t.html

It is important to note that NFC_SETTING_ENABLED can be set to true, but not to false, by using the nfc_set_setting() function. An attempt to set NFC_SETTING_ENABLED to false through this function will result in an error of NFC_RESULT_INVALID_PARAMETER. NFC cannot be turned off programmatically; NFC remains enabled until the user explicitly disables NFC from the NFC menu on the device.

Thanks,
Kareem.
Kareem ELSayed | Application Development Consultant | Developer Relations | BlackBerry | Twitter:@kemobyte
Developer
SuhairZain
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B

Re: Turn On NFC programatically

hi, thanks for the suggestion, but it throws an error as follows:

 

 

Description Resource Path Location Type
make[2]: *** [o.le-v7-g/ConnectMe] Error 1 ConnectMe C/C++ Problem
make[1]: *** [debug] Error 2 ConnectMe C/C++ Problem
make: *** [Device-Debug] Error 2 ConnectMe C/C++ Problem

 

 

nfc_result_t result = nfc_set_setting(NFC_SETTING_ENABLED_ASYNC, TRUE);

OR

nfc_set_setting(NFC_SETTING_ENABLED_ASYNC, TRUE);

 

I tried both of these, but get the same error. Any idea what might be wrong?

BlackBerry Development Advisor
Kareem_ELSayed
Posts: 81
Registered: ‎09-09-2013
My Device: BlackBerry Z10

Re: Turn On NFC programatically

Hello,

Please Try out the Code snippets in this post and let me know if it help.

http://supportforums.blackberry.com/t5/Native-Development/NFC-status/td-p/2452889

Thanks,
Kareem.
Kareem ELSayed | Application Development Consultant | Developer Relations | BlackBerry | Twitter:@kemobyte
Developer
SuhairZain
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B

Re: Turn On NFC programatically

I also tried including the necessary libraries, libnfc. But, still the error throws up.. any suggestions?

Developer
SuhairZain
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B

Re: Turn On NFC programatically

it doesn't work :smileysad:

Developer
SuhairZain
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B

Re: Turn On NFC programatically

anyone..?? plz help.. its seems like no one is replying.. please tell me how to correct the error..

Retired
robbieDubya
Posts: 418
Registered: ‎07-18-2012
My Device: Q10

Re: Turn On NFC programatically

How has this progressed?

 

Are you still stuck on building, or is it failing at run time?

 

Which OS version do you have installed?

Which SDK version do you have installed?

 

Thanks.

--
Rob is no longer associated with BlackBerry.
Developer
SuhairZain
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B

Re: Turn On NFC programatically

the error shows up at build time and i have posted the error log..

 

OS is 10.2.0.1521

SDK version 10.2 Gold

Developer
SuhairZain
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B

Re: Turn On NFC programatically

Description Resource Path Location Type
make[2]: *** [o.le-v7-g/ConnectMe] Error 1 ConnectMe C/C++ Problem
make[1]: *** [debug] Error 2 ConnectMe C/C++ Problem
make: *** [Device-Debug] Error 2 ConnectMe C/C++ Problem