Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
MarcHealthSchol's avatar
MarcHealthSchol
Honored Guest
5 years ago

Redirect to App Settings broken on Android 10 (Quest 2 headset)

Hello,
In
previous versions of Android (7 specifically) on the Oculus Quest I was
able to tell Android to open an apps detailed settings so we could
request the user to enable microphone permissions if they had previous
denied them and chosen (don't ask again).

This is using Unity 2020.1.11f1.

Here is the code that was working:
using (var unityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
                using (AndroidJavaObject currentActivityObject =
                    unityClass.GetStatic<AndroidJavaObject>("currentActivity"))
                {
                    string packageName = currentActivityObject.Call<string>("getPackageName");

                    using (var uriClass = new AndroidJavaClass("android.net.Uri"))
                    using (AndroidJavaObject uriObject =
                        uriClass.CallStatic<AndroidJavaObject>("fromParts", "package", packageName, null))
                    using (var intentObject = new AndroidJavaObject("android.content.Intent",
                        "android.settings.APPLICATION_DETAILS_SETTINGS", uriObject))
                    {
                        intentObject.Call<AndroidJavaObject>("addCategory", "android.intent.category.DEFAULT");
                        intentObject.Call<AndroidJavaObject>("setFlags", 0x10000000);
                        currentActivityObject.Call("startActivity", intentObject);
                    }
                }

Now
on the Quest 2 headset which uses Android version 10, this no longer
works but instead just shows a black screen. I've been searching google a
ton and can't seem to find anyone else that is running into this issue.

Anyone
have any idea on why this is broken in Android version 10 and how to
correctly request that the detailed app settings page be shown to the
user?

Thanks in advance



No RepliesBe the first to reply