v1.2.0 API.AI - microphone button control
This release add special button control for really easy service integration. Use this code snippet to add API.AI button to your Activity:
<ai.api.ui.AIButton
android:id="@+id/micButton"
android:layout_height="152dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
style="@style/Microphone"
/>
And this code snippet to get button ready to action:
final AIConfiguration config = new AIConfiguration("ACCESS_TOKEN",
"SUBSCRIPTION_KEY",
AIConfiguration.SupportedLanguages.English,
AIConfiguration.RecognitionEngine.System);
aiButton = (AIButton) findViewById(R.id.micButton);
aiButton.initialize(config);
aiButton.setResultsListener(this);
(don't forget to implement AIButton.AIButtonListener
of course ;)
See sample app for more details.
Attention:
-
Enumeration item RecognitionEngine.Google now deprecated. Use RecognitionEngine.System instead.
-
Library dependency now looks like:
compile 'ai.api:sdk:1.2.0@aar'
Also you need to add third party dependencies:
compile 'com.android.support:appcompat-v7:21.0.3' compile 'com.google.code.gson:gson:2.3' compile 'commons-io:commons-io:2.4'