Xiao Sense BLE ISSUE - ZephyrOS

Hi Everyone,

I am trying to develop a simple application with the XIAO BLE Sense device, the idea is to send a BLE message when something hits the device. To achieve this, I wanted to configure the BLE to notify the event after connecting with the master. I problem I have is very simple but I cant figure out how to solve it, the problem is that I always have to Enable notifications on my phone in order to receive the notification, How can I change that to receive the message without the need to enable anything on the phone?? Thanks!!

First of all, let me summarize what I am using and what program I have uploaded to the device:

  • Hardware:
    • Xiao BLE Sense.
  • Software:
    • Visual Studio Code.
    • nRF Connect for VS Code Extension Pack (latest version).
    • nRF Connect SDK Toolchain v2.5.2
    • nRF Connect SDK v2.5.2
    • Zephyr OS.

I have used the Zephyr Example for BLE and I have the following piece of code:

/* Accel readings Service Declaration and Registration */
                   NULL, on_receive, NULL),
                   NULL, NULL, NULL),

int bt_ready(void) {
    return perform_bt_ready();

int my_service_init(void)
    int err = 0;
    memset(&data_rx, 0, MAX_TRANSMIT_SIZE);
    memset(&data_tx, 0, MAX_TRANSMIT_SIZE);
    return err;

void my_service_send(const uint8_t *data, uint16_t len)
    The attribute for the TX characteristic is used with bt_gatt_is_subscribed 
    to check whether notification has been enabled by the peer or not.
    Attribute table: 0 = Service, 1 = Primary service, 2 = RX, 3 = TX, 4 = CCC.
    const struct bt_gatt_attr *attr = &accel_service.attrs[3]; 

    struct bt_gatt_notify_params params = 
        .uuid   = BT_UUID_ACCELSERVICE_TX,
        .attr   = attr,
        .data   = data,
        .len    = len,
        .func   = on_sent

    // Check whether notifications are enabled or not
    if(bt_gatt_is_subscribed(my_connection, attr, BT_GATT_CCC_NOTIFY)) 
        // Send the notification
	    if(bt_gatt_notify_cb(my_connection, &params))
            printk("Error, unable to send notification\n");
        printk("Warning, notification not enabled on the selected attribute\n");

Thanks beforehand, sorry for the inconveniences and looking forward to hearing from you.

Kind regards.