有什么方法可以使用 android 小部件中的 google 语音 API(默认免费版)?

Is there any way to use google speech API (default free version) from android widget?

我正在尝试从 android 小部件启用 google 语音 API。我的想法是,如果有人点击小部件中的按钮,API 将开始收听。

AppWidgetProvider 只是一个 BroadcastReceiver。似乎 google 语音 api 需要绑定到他的服务。但是你不能绑定到广播接收器的服务。所以方法是使用另一个服务,bindService 就可以了。

所以只需启动您的服务(从 remoteViews 单击按钮)并在此处使用语音 api 制作所有内容。