tencent cloud

Feedback

uni-app (Anroid&iOS)

Last updated: 2024-04-03 17:23:11
    This article introduces how to use the custom ringtone and silent incoming call ringtone feature from the definition.

    Customize Incoming Call Ringtone

    Setting Custom incoming call ringtone, here only local file addresses can be passed in, it is required to ensure the file directory is accessible by the application.
    const TUICallKit = uni.requireNativePlugin('TencentCloud-TUICallKit');
    
    const tempFilePath = './static/rain.mp3'; // Locally stored audio files
    let musicFilePath = '';
    uni.saveFile({
    tempFilePath: tempFilePath,
    success: (res) => {
    console.warn(JSON.stringify(res));
    musicFilePath = res.savedFilePath;
    musicFilePath = plus.io.convertLocalFileSystemURL(musicFilePath);
    // Set ringtone
    TUICallKit.setCallingBell(musicFilePath, (res) => {
    if (res.code === 0) {
    console.log('setCallingBell success');
    } else {
    console.log(`setCallingBell failed, error message = ${res.msg}`);
    }
    });
    },
    fail: (err) => {
    console.error(err);
    },
    });

    Silent incoming call ringtone

    Enable/Disable incoming call ringtone.
    After enabling, the incoming call ringtone will not be played when a call request is received.
    const TUICallKit = uni.requireNativePlugin('TencentCloud-TUICallKit');
    const enable = true;
    TUICallKit.enableMuteMode(enable);
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support