- Home /
How to ask for permissions in Android for communicating with stockfish binary in Unity
I am trying to load stockfish android binary for the android App.
string filepath = Application.persistentDataPath + "/" + "stockfish.android.armv7.so";
UnityEngine.Debug.Log(filepath);
if (!File.Exists(filepath))
{
WWW executable = new WWW("jar:file://" + Application.dataPath + "!/assets/" + "stockfish.android.armv7.so");
while (!executable.isDone)
{
}
File.WriteAllBytes(filepath, executable.bytes);
//change permissions via plugin
}
//code to get permissions to communicate with .so file
Stock fish location
Assets/Plugins/Android/stockfish-10-armv7.so
stockfish location in Android build
/data/com.DefaultCompany.NewUnityProject/files/stockfish.android.armv7.so
adb logcat log
02-13 10:41:17.798: E/Unity(15538): Win32Exception: ApplicationName='/storage/emulated/0/Android/data/com.DefaultCompany.NewUnityProject/files/stockfish.android.armv7.so', CommandLine='', CurrentDirectory='', Native error= mono-io-layer-error (0)
02-13 10:41:17.798: E/Unity(15538): at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0
Any ideas for handling such a case will be helpful.
I think my logic for Getting permission is broken. I have no idea how I can do it. Can this be done from scratch?
According to the post
https://chess.stackexchange.com/questions/17685/how-to-send-uci-messages-from-c-app-to-stockfish-on-android
user grants permission using
string[] cmd = { "chmod", "744", Path.Combine(strToFolder, fileName) };
Java.Lang.Runtime.GetRuntime().Exec(cmd);
Java.Lang.Runtime
part is the native java code. I am not sure how to achieve same thing in Unity
Your answer
Follow this Question
Related Questions
Unity Install permission issues with AppData 0 Answers
How do I get Internet Permission on Android M with Unity 5.3.5 0 Answers
I want to export from Unity to Oculus Rift. I'm using Unity 5.1.2p3. 0 Answers
GPS Locate.permission Android? 0 Answers
does unity 5.3 android sms billing status require configuration changes ? 0 Answers