#!/bin/sh

# Check if the correct number of arguments are provided
if [ "$#" -ne 2 ]; then
    echo "Usage: $0 <path/to/your/app.apk> <package_name>"
    exit 1
fi

# Get the APK path and package name from the command-line arguments
APK_PATH=$1
PACKAGE_NAME=$2

# Define the main activity of your app (assuming it's a standard MainActivity)
MAIN_ACTIVITY=".MainActivity"

# Install the APK on the connected device
echo "Installing APK..."
pm install -r "$APK_PATH"

# Check if the installation was successful
if [ $? -eq 0 ]; then
    echo "APK installed successfully."

    # Launch the app
    echo "Launching app..."
#    am start -n "$PACKAGE_NAME/$PACKAGE_NAME$MAIN_ACTIVITY"

#    if [ $? -eq 0 ]; then
#        echo "App launched successfully."
#    else
#        echo "Failed to launch the app."
#    fi
else
    echo "Failed to install APK."
fi

