Activate Alexa With Bixby Button
by DFranzen in Circuits > Mobile
2220 Views, 1 Favorites, 0 Comments
Activate Alexa With Bixby Button
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
- Open Android Studio and create a new project with File -> New -> New Project
- Select the "Empty Activity" and confirm with Next
- Select Language "Java" and input reasonable data, for example
- Name: Alexa_Launcher
- API 16: Android 4.1 (Jelly Bean)
- Confirm with Finish
- Wait until the empty project has been created.
- In the Project explorer on the left select app -> java -> com.example.alexa_launcher (or your name from before) -> MainActivity
- In the file on the right:
- Delete everything but the first line
- 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
On your Android phone:
- If you don't have developer mode enabled yet, follow for example the following Instructables
- Open the Settings App
- Navigate to Developer Options
- Navigate to USB debugging and enable it
- Connect your phone to the PC
- Allow your PC to perform USB debugging, when asked
Step 3: Install App
Back in Android Studio:
- In the top right corner select your Android Model
- Click the green Run-Arrow to the right of the Model selection field
- 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
All, that is left now, is to tell the Bixby-Button to launch our new app:
- Open the Settings app again.
- Search for "Bixby Key" with the build in search function and select the entry "Bixby Key"
- Select Bixby Key again
- Chose "Double press to open Bixby and underneath click on Use single press
- 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.