변경전
using (var unityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
using (var currentActivityObject = unityClass.GetStatic<AndroidJavaObject>("currentActivity"))
{
var packageName = currentActivityObject.Call<string>("getPackageName");
using (var uriClass = new AndroidJavaClass("android.net.Uri"))
using (var uriObject = uriClass.CallStatic<AndroidJavaObject>("fromParts", "package", packageName, null))
using (var intentObject = new AndroidJavaObject("android.content.Intent", "android.settings.ACTION_SETTINGS", uriObject))
{
intentObject.Call<AndroidJavaObject>("addCategory", "android.intent.category.DEFAULT");
intentObject.Call<AndroidJavaObject>("setFlags", 0x10000000);
currentActivityObject.Call("startActivity", intentObject);
}
}
변경 후
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);
android.settings.ACTION_SETTINGS을 사용하면 에러 발생
android.settings.APPLICATION_DETAILS_SETTINGS으로 변경해야함
참고
https://developer.android.com/reference/android/provider/Settings#ACTION_APPLICATION_DETAILS_SETTINGS