BLE on android cannot call onCharacteristicChanged()

I’m tring to develope a demo of bel communication
BLE server runs on a linux board with BT module, the server is developed with python-dbus, and the part of Characteristic is shown as below

class DapUsrInfoCharacteristic(bluetooth_gatt.Characteristic):
    bonded = False
    def __init__(self, bus, index, service):
        bluetooth_gatt.Characteristic.__init__(
                self, bus, index,
                bluetooth_constants.DAP_CHR_UUID,
                ['read', 'write', 'notify'],
                service)
                # ['encrypt-authenticated-read', 'encrypt-authenticated-write', 
                #  'notify'],
                # service)

    def ReadValue(self, options):
        # Replace this with the actual value to be read
        show_log(LOG_LEVEL.INFO, "Reading value from client")
        return dbus.ByteArray([0x01])
    
    def WriteValue(self, value, options):
        # self.do_notify(value)
        self.callback(CallbackType.BLE_RECVD_MSG, value)
        # self.parse_msg_from_client(value)
    
    def StartNotify(self):
        show_log(LOG_LEVEL.INFO, "starting notifications")
        self.notifying = True

    def StopNotify(self):
        show_log(LOG_LEVEL.INFO, "stopping notifications")
        self.notifying = False

    def register_callback(self, callback):
        self.callback = callback

    def do_notify(self, value):
        self.StartNotify()
        if not self.notifying:
            show_log(LOG_LEVEL.INFO, "Not notifying")
            return
        show_log(LOG_LEVEL.INFO, f"Sending message to client: {value}")
        
        self.PropertiesChanged(bluetooth_constants.GATT_CHARACTERISTIC_INTERFACE, {'Value': value}, [])
        show_log(LOG_LEVEL.INFO, f"Message sent to client: {value}")

    def parse_msg_from_client(self, value):
        msg_type = int(value[0])
        if msg_type == BLE_MSG_TYPE.BONDED.value:
            self.bonded = bool(value[1])
            show_log(LOG_LEVEL.INFO, f"Bond status: {self.bonded}")
            self.callback(CallbackType.BLE_BONDED, None)
        else:
            show_log(LOG_LEVEL.INFO, f"Unknown message type: {value}")

BLE client is a Android phone, I can read and write value of the characteristic on the BLE server. However, It does not work when I want to subscribe the notification for the characteristic, the most related part code of Android is shown as below:

/* Gatt call back */
private BluetoothGattCallback gattCallback = new BluetoothGattCallback() {
        ...

        @Override
        public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) {
            Log.d(TAG, "Descriptor write status: " + status);
            if (status == BluetoothGatt.GATT_SUCCESS) {
                Log.d(TAG, "Descriptor written");
                mainHandler.post(() ->  eventSink.success("Descriptor written"));
            }
        }

        @Override
        public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
            Log.d(TAG, "------------------");
            byte[] value = characteristic.getValue();
            Log.d(TAG, "Characteristic changed: " + Arrays.toString(value));
            mainHandler.post(() ->  eventSink.success("Characteristic changed: " + Arrays.toString(value) + "n"));
        }
    };

/*Enable characteristic notification*/
boolean isEnableNotification =  bluetoothGatt.setCharacteristicNotification(targetCharacteristic, true);
if (!isEnableNotification) {
                    Log.e(TAG, "Failed to enable notification");
                    return;
                }
                Log.d(TAG, "Characteristic notification enabled");

                List<BluetoothGattDescriptor> descriptors = targetCharacteristic.getDescriptors();
                Log.d(TAG,"Total descriptors: " + descriptors.size());
                for (BluetoothGattDescriptor descriptor : descriptors) {
                    Log.d(TAG, "Descriptor: " + descriptor.getUuid().toString());
                    descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
                    descriptor.setValue(BluetoothGattDescriptor.ENABLE_INDICATION_VALUE);
                    boolean isWriteDesp = bluetoothGatt.writeDescriptor(descriptor);
                    Log.d(TAG, "Descriptor write status: " + isWriteDesp);
                }
                Log.d(TAG, "Finished writing descriptors");        

Could you plz give some advice? Thanks very much!

Could you plz give some advice? Thanks very much!

Try to writeDescriptor after you setCharacteristicNotification and choose the UUID you want to subscribe, for example:

val descriptor: BluetoothGattDescriptor =
                characteristic.getDescriptor(convertFromInteger(0x2902))

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
    descriptor.value = BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE
    gatt.writeDescriptor(descriptor)
} else
    gatt.writeDescriptor(descriptor, BluetoothGattDescriptor.ENABLE_INDICATION_VALUE)

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật