Embeddable custom voice assistant for Android applications
Just clone this repository and try to build and run the app module 😉
If you want some details - there is how to do the same with your hands.
android {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
repositories {
mavenCentral()
}
dependencies {
implementation("com.just-ai.aimybox:core:$aimyboxVersion")
implementation("com.just-ai.aimybox:components:$aimyboxVersion")
}
Use the latest version
implementation("com.just-ai.aimybox:google-platform-speechkit:$aimyboxVersion")
Create a new project in Aimybox console, enable some voice skills and copy your project's API key.
Instantiate Aimybox in your Application class like that
class AimyboxApplication : Application(), AimyboxProvider {
companion object {
private const val AIMYBOX_API_KEY = "your Aimybox project key"
}
override val aimybox by lazy { createAimybox(this) }
private fun createAimybox(context: Context): Aimybox {
val unitId = UUID.randomUUID().toString()
val textToSpeech = GooglePlatformTextToSpeech(context)
val speechToText = GooglePlatformSpeechToText(context)
val dialogApi = AimyboxDialogApi(AIMYBOX_API_KEY, unitId)
val aimyboxConfig = Config.create(speechToText, textToSpeech, dialogApi)
return Aimybox(aimyboxConfig)
}
}
FrameLayout
to your application's layout like this
<FrameLayout android:id="@+id/assistant_container" android:layout_width="match_parent"
android:layout_height="match_parent" />
AimyboxAssistantFragment
in your activity that uses this layout (
like here)override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.layout_activity_main)
supportFragmentManager.beginTransaction().apply {
replace(R.id.assistant_container, AimyboxAssistantFragment())
commit()
}
}
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<!-- Customize Assistant components here -->
<item name="aimybox_assistantButtonTheme">@style/CustomAssistantButtonTheme</item>
<item name="aimybox_recognitionTheme">@style/CustomRecognitionWidgetTheme</item>
<item name="aimybox_responseTheme">@style/CustomResponseWidgetTheme</item>
<item name="aimybox_imageReplyTheme">@style/CustomImageReplyWidgetTheme</item>
<item name="aimybox_buttonReplyTheme">@style/CustomButtonReplyWidgetTheme</item>
</style>
<style name="CustomAssistantButtonTheme" parent="DefaultAssistantTheme.AssistantButton"></style>
<style name="CustomRecognitionWidgetTheme"
parent="DefaultAssistantTheme.Widget.Recognition"></style>
<style name="CustomResponseWidgetTheme" parent="DefaultAssistantTheme.Widget.Response"></style>
<style name="CustomButtonReplyWidgetTheme"
parent="DefaultAssistantTheme.Widget.ButtonReply"></style>
<style name="CustomImageReplyWidgetTheme"
parent="DefaultAssistantTheme.Widget.ImageReply"></style>
</resources>
Now you can run your application and tap a small microphone button in bottom right corner of the screen. Try to say some phrase that corresponds to any of enabled voice skills in your Aimybox project.
Your assistant will handle all job regarding speech recognition, processing, displaying and synthesising of the response.
Please refer to the demo app to see how to use Aimybox library in your own project.
There is a full Aimybox documentation available here. It's better to start with our Quick Start to make first steps with Aimybox.