Getting WiFi/Bluetooth access in Unity by Java Classes?,Using Android Network Management in Unity (AR)
Hi, for my project i need to setup an augmented reality app (Vuforia) in Unity on an Android device --> works fine Additionaly i need to communicate on background with a second component over WiFi or Bluetooth. I saw different assets from the store but nothing usefull for FREE, i wont pay for that. I know thats no problem to create this kind of communication in Android Studios or InteliJ (java), but in Unity with C# it seems a bit complicated. Is there an easy way to get this setup working? I tried to work with AndroidJavaObject.Call but i cant get it working effectively.
My example for testing doesnt work:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class JavaTest : MonoBehaviour {
public Text txt;
void Start() {
AndroidJavaObject jo = new AndroidJavaObject("android.bluetooth.BluetoothAdapter");
int address = jo.Call<int>("getState");
Debug.Log("State: " + address);
txt.text = "State: " + address;
}
}
I attached this script to my ARCamera so it should run by itselfe. If i try to get the hash value of a given string (java.lang.String) it works fine.
Thanks for helping me out!