Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Oculus Quest trigger APK Installer

Discussion in 'Android' started by Alexfedel, Feb 24, 2021.

  1. Alexfedel

    Alexfedel

    Joined:
    Sep 25, 2015
    Posts:
    15
    I'm working on an Oculus Quest app and wanted to add the option to auto update the Android app.
    So far I'm able to download an apk file and call some android java code to force starting the package installer, but with no success.

    Code (Java):
    1. Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
    2. intent.setDataAndType(fileUri, "application/vnd.android.package-archive");
    3. intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true);
    4. intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    5. intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    6. context.startActivity(intent);
    The screen becomes black and showing 3 loading dots, but nothing happens and the app won't update. It works on an android smartphone, but not on the Oculus. Android 10 is installed. Does anyone has an idea why it is not working and how I'm able to install my downloaded apk file by opening the default android package installer?
     
  2. Alexfedel

    Alexfedel

    Joined:
    Sep 25, 2015
    Posts:
    15
    Okay, I found some kind of solution.
    Since for some reason the Oculus is not able to display a user dialog to commit the installation of an APK file, I ended up to make my app a Device Owner app. With the Device Owner privilege I'm able to install the APK file silently without some kind of user interaction.
     
  3. JonOssoVR

    JonOssoVR

    Joined:
    Mar 15, 2018
    Posts:
    2
    Hi, how did you make your app a Device Owner?
     
  4. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,444
    Any tips on how you managed to do this? I have seen apps like Sidequest doing this on the device without any weird adb commands