+1 vote
by (300 points)
recategorized by

Hi all, hope someone can help.

I'm currently testing on Neo 3 Pro, PUI V4.3.23, and developing on Unity.

My app requires it to re-install itself and install other app. However, when I invoke the installation, the Android Permission UI shows up in 2D mode and right in front of the eye. I couldn't interact with it or point my controller at it.

Would there be any solution or work around for this so that the Permission UI appears in 3D mode so I can interact with it?

The permission prompt appears in 2D mode

1 Answer

+1 vote
by (30.5k points)
selected by
 
Best answer

Hi,
You can try to use the following code.

fun installApp(path: String?) {
    val version = Build.VERSION.SDK_INT
    val file = File(path)
    val apkUri: Uri = FileProvider.getUriForFile(this, "com.pvr.filemanager.fileprovider", file)
    val extraIntent = Intent(Intent.ACTION_VIEW)
    extraIntent.setDataAndType(apkUri, "application/vnd.android.package-archive")
    extraIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
    extraIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
    if (version < Build.VERSION_CODES.P) {
        startActivity(extraIntent)
    } else {
        val intent = Intent("pvr.intent.action.VRSHELL")
        intent.putExtra("intent", extraIntent)
        startActivity(intent)
    }
}

Note: This is the Android code and needs to be converted before it can be used in unity.

by (300 points)

Hi, thank you. This solved my problem.
Much appreciated!

...