Search code examples
androidembeddedapkandroid-thingsandroid-things-console

How to call an added APK to androidthings image


I am working with this project https://github.com/hypeapps/black-mirror . As I am a complete newbie to droid I am wondering what the process would be to call a apk that has been added to the androidthings image from androidthings console. Say I have an APK com.lafitness.lafitness.apk that has been added to the android things image. How would I open that APK from an android speech recognized phrase. Would I do this using Package manager from an intent?


Solution

  • If you have added the APK to your system image, you can then call the app from an intent using the app's package name.

    PackageManager manager = getPackageManager();
    Intent intent = manager.getLaunchIntentForPackage("com.lafitness.lafitness.apk");
    intent.addCategory(Intent.CATEGORY_LAUNCHER);
    startActivity(intent);
    

    Using the Android speech API is a different question, but should be the same as on an Android phone (but I'm not certain of that).