Activate Alexa With Bixby Button

by DFranzen in Circuits > Mobile

2220 Views, 1 Favorites, 0 Comments

Activate Alexa With Bixby Button

Screenshot_20210320-175723_Amazon Alexa_.jpg

Samsung Phones have a dedicated Bixby-Button to lauch Samsung's own digital assistant. Some people do however prefer Alexa as digital assistant. Android lets you choose the assistant, but the Bixby-Button is tied to Bixby.

At some point Samsung allowed the users to configure the Bixby-Button to only start Bixby on a double press and instead launch any app with a single click. Any app? Well, not entirely... One small category of apps is specifically excluded from the list of selectable apps: Digital assistants. And so Alexa is not available on the Bixby Button.

However the Bixby setting only excludes the Alexa App itself. This project therefore sets out to create a simple App yourself, which just launches the Alexa-App in listening mode and then closes itself. The best thing about it: you don't need to install any shady apps, that need a plethora of permissions, but you can create the app yourself with just a few lines of code.

Requirements:

Hardware

We need a PC with a free USB-port and a suitable cable to connect the phone to this USB-Port

Software

We need the Android Studio installed on your PC. Follow the official instruction on the Android page.

Also, the official app "Amazon Alexa" needs to be installed on the phone.

Step 1: Create the App

NewProject.png
EmptyAct.png
ProjectConf.png
ProjectTree.png
  1. Open Android Studio and create a new project with File -> New -> New Project
  2. Select the "Empty Activity" and confirm with Next
  3. Select Language "Java" and input reasonable data, for example
    • Name: Alexa_Launcher
    • API 16: Android 4.1 (Jelly Bean)
  4. Confirm with Finish
  5. Wait until the empty project has been created.
  6. In the Project explorer on the left select app -> java -> com.example.alexa_launcher (or your name from before) -> MainActivity
  7. In the file on the right:
    1. Delete everything but the first line
    2. Copy the code into the file
import androidx.appcompat.app.AppCompatActivity;import android.content.Intent;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String activityAction = "android.intent.action.ASSIST";
Intent intent = new Intent(activityAction);
intent.setPackage("com.amazon.dee.app");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MainActivity.this.getApplicationContext().startActivity(intent);
finish();
}
}

Step 2: Prepare the Phone

Screenshot_20210320-174206_Finder.jpg
Screenshot_20210320-174220_Settings.jpg
Screenshot_20210320-174316_Settings.jpg

On your Android phone:

  1. If you don't have developer mode enabled yet, follow for example the following Instructables
  2. Open the Settings App
  3. Navigate to Developer Options
  4. Navigate to USB debugging and enable it
  5. Connect your phone to the PC
  6. Allow your PC to perform USB debugging, when asked

Step 3: Install App

InstallApp.png

Back in Android Studio:

  1. In the top right corner select your Android Model
  2. Click the green Run-Arrow to the right of the Model selection field
  3. The App is installed on your phone now, this might take a moment and will finish with Alexa launching for the first time from your new app.

You can unplug your phone from your computer now. If you want disable USB-Debugging again (as in Step 2)

Step 4: Configure Bixby Button

Screenshot_20210320-175222_Settings Suggestions.jpg
Screenshot_20210320-175226_Settings.jpg
Screenshot_20210320-175233_Bixby Voice.jpg
Screenshot_20210320-175238_Bixby Voice.jpg

All, that is left now, is to tell the Bixby-Button to launch our new app:

  1. Open the Settings app again.
  2. Search for "Bixby Key" with the build in search function and select the entry "Bixby Key"
  3. Select Bixby Key again
  4. Chose "Double press to open Bixby and underneath click on Use single press
  5. Chose "Open App" and then click on the gear to select our new app "Alexa_Launcher"

Congratulation!! Your Bixby-Button is now an Alexa-Button.