Android getRecordNumDrivers always gives back 0

numdrivers and numconnected both always return 0 when ran on the Android Unity app I made. It works fine on PC when I run it in the Unity editor. I’ve gone through the previous threads about the issue and I implemented the solutions I found but they haven’t worked.

// CODE
void Start () {

string filePath1 = Application.persistentDataPath + "/micList.txt";
File.AppendAllText(filePath1, "Start List:\n");
foreach (var device in Microphone.devices)
{
    File.AppendAllText(filePath1, "(" + device.ToString() + ")\n");
}

var lowlevelSystem = FMODUnity.RuntimeManager.LowlevelSystem;

FMOD.System system;
FMOD.Factory.System_Create(out system);

uint version;
lowlevelSystem.getVersion(out version);

lowlevelSystem.setOutput(FMOD.OUTPUTTYPE.OPENSL);

lowlevelSystem.init(100, FMOD.INITFLAGS.NORMAL, (System.IntPtr)null);

int numdrivers, numconnected;

lowlevelSystem.getRecordNumDrivers(out numdrivers, out numconnected);

//Debug.Log("numdrivers: " + numdrivers + "\nnumconnected: " + numconnected + "\n");
string filePath = Application.persistentDataPath + "/UWVRdrivers.txt";
File.AppendAllText(filePath, "Start List:\n");
File.AppendAllText(filePath, "numdrivers: " + numdrivers + "\nnumconnected: " + numconnected + "\n");

}

http://www.fmod.org/questions/tags/android/

Some functionality inside of FMOD will require you set relevant permissions in your AndroidManifest.xml file.

  • Recording - to make use of the System::recordStart API use android.permission.RECORD_AUDIO.

https://fmod.com/resources/documentation-api?page=content/generated/platform_android/basics.html#/

I used the microphone class so that should do the same thing automatically

Can you share any errors/warnings you are getting, or the log from the device?

I’m pretty new to android development on Unity. The app does crash or anything. I don’t really know how to get the log or where to find any errors or warnings on Android.

I usually run the monitor tool that comes with the SDK to get the phone logs.
("…\android-sdk-windows\tools\monitor.bat")

Also make sure to use the Development Build option as it will have more logging.

I’m using the FMOD Unity plugin on Unity and building for android in Unity. Isn’t that an sdk for windows?

The Android SDK is separate from Unity. You can check the directory in the Unity menu: Edit>Preferences>External Tools