Hi! I created simple plugin for android apps. But for some strange reason the result of calling of my function is always “false”. My plugin should inform the app about is phone muted or not. Here is code of my plugin:
import android.app.Fragment;
import android.content.Context;
import android.media.AudioManager;
public class AndroidMuteCtrl extends Fragment {
public static String debugThis()
{
return "Test message from AndroidMuteCtrl plugin.";
}
public boolean isMuted()
{
AudioManager audio = (AudioManager) this.getActivity().getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
if (audio.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) return false;
else return true;
}
}
And my c# code:
//...
AndroidJavaClass pluginClass = new AndroidJavaClass("com.overly.mutecontrol.AndroidMuteCtrl");
//...
bool isMuted = pluginClass.Call<bool>("isMuted"); // ALWAYS FALSE
//...