Hi I am in a struggle at assigning a BitSet value in a Android Java Object I’m referencing.
I tried with Int, or even to copy the referred value into a AndroidJavaObjects and now I am short of Ideas.
Here is part of my code, I am making a HotSpot manager inside the game itself.
I’m debugging with logcat and I am putting a Debug.Log every row to see where the code stops
What I need is to assign AuthAlgorithm to OPEN, without having the BitSet type in C#
Thanks in advance.
using (AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity"))
{
try
{
using (var WifiSetup = activity.Call<AndroidJavaObject>("getSystemService", "wifi"))
{
AndroidJavaObject newConnection = new AndroidJavaObject("android.net.wifi.WifiConfiguration");
newConnection.Set<string>("SSID", mSSID);
newConnection.Set<string>("preSharedKey", mPWD);
newConnection.Set<bool>("hiddenSSID", false);
//THOSE UP HERE WORK!
//DOESN'T WORKS LIKE THIS:
newConnection.Set<int>("allowedAuthAlgorithms", 0);
//DOESN'T WORKS EVEN LIKE THIS (breaks at definition)
AndroidJavaObject OPEN = new AndroidJavaObject("android.net.wifi.WifiConfiguration.WifiConfiguration.AuthAlgorithm.OPEN");
newConnection.Set<AndroidJavaObject>("allowedAuthAlgorithms", OPEN);
//THIS DEFINITION WORKS
AndroidJavaObject allowedAuthAlgorithms = newConnection.Get<AndroidJavaObject>("allowedAuthAlgorithms");
//NEITHER THIS ONE WORKS
allowedAuthAlgorithms.Call<int>("set", "WifiConfiguration.AuthAlgorithm.OPEN");
//CODE CONTINUES THE REST IS WORKING AND TESTED