Hi I am currently trying to install an apk through a installer apk on the Quest, but this causes weird runtime behaviours that don’t occur if installing through the generated bat file
We are running the following code to install the apk (this is in the installer program):
Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
intent.setDataAndType(FileProvider.getUriForFile(this, getApplicationContext().getPackageName() + ".provider", new File(url)), "application/vnd.android.package-archive");
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Intent.EXTRA_RETURN_RESULT, true);
startActivityForResult(intent, INSTALL_REQUEST_CODE);
The issue doesn’t occur until we try to retrive the save data, and that fails, everytime even though the save data exist and it is the exact same apk, but when running it through the bat everything works, so my suspicion, is that there is something wrong with the android code that I posted above. I am quite new to the whole android development so I would appreciate any help I can get
I don’t have a specific answer for you, but I just wanted to mention that I’m doing something similar in Unity. I have code to download a new .apk and install it in order to update my application. This works on Android phones, but the same code has not worked for me so far on Quest.
Here’s the code as well as some other setup needed to make this work in Unity. You may be able to get some of what you need from here (like AndroidManifest details and picking apart the Android code). Unfortunately, this hasn’t fully worked on the Quest. I don’t get any exceptions with the Intent, but the device just goes to a black loading screen.
Is your APK Installer app a normal Quest VR application?
Thanks for the assist BioeJD
I tried these things you mention using the ACTION_VIEW instead altough it gave the same result.
I found a solution to the problem so I was thinking of just posting the solution here just in case anyone in the future have the same problem as me
I found the solution by comparing the generated bat file and my code, the problem was with permissions accessing the external storage, so in the main apk (the one I tried installing) in the game instance I made a check if I had permissions or not, if I didn’t have permission I used the unreals RequestAndroidPermissions function to grant me the READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permission.