如何让Google Assistant识别并启动自定义.NET C#(MAUI)应用?
解决Google Assistant无法识别并启动MAUI应用的问题
Google Assistant识别应用主要依赖Android平台的应用标签配置,以下是无需付费的解决步骤:
修改AndroidManifest.xml中的应用标签
打开项目内Platforms/Android/AndroidManifest.xml文件,找到<application>标签,添加或修改android:label属性,值设为你希望语音指令中使用的应用名称(比如"MyApp"),示例代码:<application android:allowBackup="true" android:icon="@mipmap/appicon" android:label="MyApp" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true">注意:标签名称要和语音指令里的名称完全一致,避免拼写、空格差异。
确认主Activity的启动配置
检查主Activity的intent-filter是否包含MAIN和LAUNCHER类别,且android:exported设为true,确保Assistant能找到启动入口,示例配置:<activity android:name=".MainActivity" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>验证设备端Assistant应用列表
在S22 Ultra上打开Google应用,进入「设置」>「Google Assistant」>「应用和设备」>「应用」,确认你的应用(MyApp)已在列表中。若未显示,重启设备或重新安装应用后再检查。测试精准语音指令
使用与android:label完全匹配的名称发起指令,比如标签设为"MyApp",就说“OK Google, open MyApp”,不要添加额外词汇或变体。若仍有问题,可在设备「设置」>「应用」>「MyApp」>「应用信息」中查看系统显示的应用名称是否与配置一致。
内容的提问来源于stack exchange,提问作者Frank Dzaebel
相关产品推荐
相关产品推荐

