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 { jcenter() } dependencies { implementation("com.justai.aimybox:core:0.15.0") implementation("com.justai.aimybox:components:0.1.10") }
implementation("com.justai.aimybox:google-platform-speechkit:0.15.0")
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) return Aimybox(Config.create(speechToText, textToSpeech, dialogApi)) }
}
FrameLayoutto your application's layout like this
AimyboxAssistantFragmentin 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() }
}