English
English
简体中文
Contact Us
Register
Log In
layoutIndex

Voice Assistant UI BizBundle

Last Updated on : 2022-06-23 10:00:52download

Voice Assistant UI BizBundle for iOS supports voice control features of smart devices. The UI BizBundle can be integrated to implement voice assistant services and promote user experience in smart life scenarios. The voice assistant applies to a variety of smart devices developed on the Tuya IoT Development Platform and simplifies the voice control of these devices.

Before you start

  • This UI BizBundle depends on Smart Life App SDK. You must complete the steps in Preparation and Integrate with Framework for the Smart Life App SDK before the subsequent procedure.

  • This UI BizBundle also depends on the value-added service App Voice Assistant. You must subscribe to the service before this UI BizBundle can be used.

Integrate with the UI BizBundle

Add the components of the Voice Skills Account Linking UI BizBundle to the Podfile and run the command pod update.

source "https://github.com/tuya/TuyaPublicSpecs.git"
source 'https://cdn.cocoapods.org/'

target 'your_target_name' do
  # Adds a component.
  pod 'TuyaSmartSpeechBizBundle'
end

Service protocols

The Voice Skills Account Linking UI BizBundle relies on the implementation of the protocol TYSpeechProtocol to provide services. You can view the TYSpeechProtocol.h file in the TYModuleServices component.

@protocol TYSpeechProtocol <NSObject>

/**
 Navigates to the voice command controller.
 Checks whether to enable the MIC permissions and verify the login status before navigation.
 */
- (void)showSpeechController;

/**
 Checks whether the configurations of the current account are ready to display the entry to voice recognition.
 */
- (BOOL)shouldShowSpeechEntrance;

@end

Example

ObjC:

#import <TuyaSmartBizCore/TuyaSmartBizCore.h>
#import <TYModuleServices/TYModuleServices.h>


id<TYSpeechProtocol> impl = [[TuyaSmartBizCore sharedInstance] serviceOfProtocol:@protocol(TYSpeechProtocol)];
if ([impl shouldShowSpeechEntrance]) {
    id<TYSpeechProtocol> impl = [[TuyaSmartBizCore sharedInstance] serviceOfProtocol:@protocol(TYSpeechProtocol)];
    [impl showSpeechController];
}

Swift:

Do not use the following as method. Otherwise, nil will be returned after impl is called.

let impl :TYSpeechProtocol = TuyaSmartBizCore.sharedInstance().service(of: TYSpeechProtocol.self) as! TYSpeechProtocol

Recommended example:

let impl  = TuyaSmartBizCore.sharedInstance().service(of: TYSpeechProtocol.self);
let entrance = (impl as AnyObject).shouldShowSpeechEntrance()
if entrance == true {
    (impl as AnyObject).showSpeechController()
}

Things to note

After the voice assistant is activated, speech recognition is supported when:

  • The user’s mobile phone system language is Chinese, and the user account is registered in mainland China.
  • The user’s mobile phone system language is English, and the user account is registered outside mainland China.

Certain advanced features are available only when the required value-added services are purchased. Example:

  • Animated theme colors
  • Widget images