Cordova语音识别插件;无效操作“;
我正在尝试使用此插件: 所有设置都正常,但当我调用Cordova语音识别插件;无效操作“;,cordova,ionic-framework,ionic2,speech-recognition,Cordova,Ionic Framework,Ionic2,Speech Recognition,我正在尝试使用此插件: 所有设置都正常,但当我调用isRecognitionAvailable()时,我收到一个拒绝承诺的消息,错误消息为:无效操作“ 我已经检查了生成的AndroidManifest.xml和所有这些内容中的所有权限和版本是否正确 注意:我正在使用Wifi。 这是我的代码: let options = { language: 'en-US', matches: 1, prompt: '', showPopup: false, showPa
isRecognitionAvailable()
时,我收到一个拒绝承诺的消息,错误消息为:无效操作“
我已经检查了生成的AndroidManifest.xml和所有这些内容中的所有权限和版本是否正确
注意:我正在使用Wifi。
这是我的代码:
let options = {
language: 'en-US',
matches: 1,
prompt: '',
showPopup: false,
showPartial: false
}
this.speechRecognition.startListening(options).subscribe(
(matches: Array<string>) => {
// matches arrive here....
},
(onerror) => {
alert(JSON.stringify(onerror));
}
);
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="io.ionic.starter" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name="cordova.plugins.Diagnostic$LocationProviderChangedReceiver">
<intent-filter>
<action android:name="android.location.PROVIDERS_CHANGED" />
</intent-filter>
</receiver>
<receiver android:name="cordova.plugins.Diagnostic$NFCStateChangedReceiver">
<intent-filter>
<action android:name="android.nfc.action.ADAPTER_STATE_CHANGED" />
</intent-filter>
</receiver>
</application>
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="25" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
let选项={
语言:“en US”,
比赛:1,,
提示:“”,
showPopup:false,
showPartial:错误
}
这个.speechRecognition.startListening(选项).订阅(
(匹配项:数组)=>{
//比赛到了。。。。
},
(onerror)=>{
警报(JSON.stringify(onerror));
}
);
清单:
let options = {
language: 'en-US',
matches: 1,
prompt: '',
showPopup: false,
showPartial: false
}
this.speechRecognition.startListening(options).subscribe(
(matches: Array<string>) => {
// matches arrive here....
},
(onerror) => {
alert(JSON.stringify(onerror));
}
);
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="io.ionic.starter" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name="cordova.plugins.Diagnostic$LocationProviderChangedReceiver">
<intent-filter>
<action android:name="android.location.PROVIDERS_CHANGED" />
</intent-filter>
</receiver>
<receiver android:name="cordova.plugins.Diagnostic$NFCStateChangedReceiver">
<intent-filter>
<action android:name="android.nfc.action.ADAPTER_STATE_CHANGED" />
</intent-filter>
</receiver>
</application>
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="25" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
谢谢。据检查,此插件需要网络才能工作。查看此以了解有关此的更多信息 您还可以查看一个示例语音识别器应用程序,该应用程序使用了不同的插件
尝试请求本文中提到的权限,因为我在您的示例中没有看到此代码。删除并重新添加android平台修复了此问题,现在我有另一个不同的问题。我真的不明白您的意思。我在最初的问题中说我已经连接到wifi了。@Dave我忽略了这一点。你能试一下移动数据吗?已经试过了,wifi关闭了。我已经检查了android清单权限是否正确。@Dave在我给出任何建议之前,我需要进一步挖掘。即使在提供了一个工作示例的链接之后,也不理解向下投票的意义。因为答案没有考虑清楚地表明我有联系的问题文本,所以感觉缺乏动力。这就是全部。谢谢我还尝试了您的工作示例,当它运行时,我立即收到一个“无效操作”错误。