How to connect to the specific app during Bluetooth connection

Hi  I am using the nrf51422_XXAC device. I want to make a connection with my app alone. other apps should not be able to connect. please help me with sample code. I am new to the device 

what I need is that only after opening the app I should connect to the device via Bluetooth that too to my app alone, like have a private key or so.

I have tried adding the code 
static ble_opt_t optS;

static uint8_t passw[]="123456";


err_code =sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &optS);


the problem is during paring, the device asks for a passkey. but connection inside app goes without a passkey