进行语音联调
This commit is contained in:
@@ -4,6 +4,7 @@ import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.mogo.module.share.constant.ShareConstants
|
||||
import com.mogo.module.share.constant.ShareConstants.VOICE_CMD_PUB_TROUBLE_HELP
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
/**
|
||||
@@ -11,11 +12,11 @@ import com.mogo.utils.logger.Logger
|
||||
*/
|
||||
class ShareVoiceCmdReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
// todo 接收唤醒词指令
|
||||
// 接收唤醒词指令
|
||||
val command = intent.getStringExtra("command")
|
||||
Logger.d("ShareCmdReceiver", "收到唤醒词指令: $command")
|
||||
if (command == "zhunbeishangbao") {
|
||||
//todo 开启服务,准备上报求助
|
||||
if (command == VOICE_CMD_PUB_TROUBLE_HELP) {
|
||||
// 开启服务,准备上报求助
|
||||
val seekHelp = Intent(context, VoiceCmdService::class.java)
|
||||
seekHelp.putExtra(ShareConstants.VOICE_CMD_SERVICE_EVENT_KEY, ShareConstants.VOICE_CMD_SERVICE_SEEK_HELP)
|
||||
context.startService(seekHelp)
|
||||
|
||||
@@ -42,7 +42,7 @@ class VoiceCmdService:Service() {
|
||||
if (intent.getIntExtra(ShareConstants.VOICE_CMD_SERVICE_EVENT_KEY,0) == ShareConstants.VOICE_CMD_SERVICE_SEEK_HELP) {
|
||||
// 收到语音指令,准备上报求助
|
||||
Logger.i(TAG, "收到语音指令,准备上报求助")
|
||||
SeekHelpManager.seekHelp(this,seekListener,false)
|
||||
SeekHelpManager.seekHelp(this,seekListener)
|
||||
}
|
||||
}
|
||||
return super.onStartCommand(intent, flags, startId)
|
||||
|
||||
@@ -18,4 +18,6 @@ public class ShareConstants {
|
||||
|
||||
public static final String VOICE_CMD_SERVICE_EVENT_KEY = "type";
|
||||
public static final int VOICE_CMD_SERVICE_SEEK_HELP = 1;
|
||||
|
||||
public static final String VOICE_CMD_PUB_TROUBLE_HELP = "com.zhidao.auxiliaryDriving.pubTroubleHelp";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user