0

I am looking for a way to trigger the Amazon Alexa official application for Android to search for given query.

I am able to launch the Amazon Alexa to trigger Alexa to listen for voice command via below code

String activityAction = "android.intent.action.ASSIST";
Intent intent = new Intent(activityAction);
intent.setPackage("com.amazon.dee.app");
MainActivity.this.getApplicationContext().startActivity(intent)

Yet - i am looking for a way to pass a query string via this intent, so Alexa app would immediate search for it.

Thanks in advance, Gal.

1 Answers1

0

I think whatever you are doing, It will just open Alexa App only (If its installed already) and it will not search automatically.

For your question I think you have to use AlexaAndroid

It will helps you to integrate Alexa in Android App.

You can add using dependency:

implementation 'com.willblaschko.android.alexa:AlexaAndroid:2.4.2'

You can use following code:

private void initAlexaAndroid(){
    //get our AlexaManager instance for convenience
    alexaManager = AlexaManager.getInstance(this, PRODUCT_ID);

    //instantiate our audio player
    audioPlayer = AlexaAudioPlayer.getInstance(this);

    //Callback to be able to remove the current item and check queue once we've finished playing an item
    audioPlayer.addCallback(alexaAudioPlayerCallback);
}

You can follow further steps here

Thank you.

Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
  • Thank you! Basically i preferring using the Amazon Alexa official application instead developing my own app. Amazon Alexa seems to be great, only missing part is to trigger it with query, which i am not sure if and how this can be done. – Gal Netanel Mar 11 '19 at 07:15