I want to use this native plugin for Android devices through Unity. For some reason, the plugin is working now. When I run it on a real device, the game crashes. I use Unity 5.5.2f1 personal, my phone is Samsung Edge 6 with Marshmallow api.
I placed the jar file inside Assest / Plugins / Android. I can not understand what is the cause of this error. Do you know what's wrong here?
This is part of my code:
private AndroidJavaObject plugin;
void Start ()
{
plugin = new AndroidJavaClass("jp.kshoji.unity.sensor.UnitySensorPlugin").CallStatic<AndroidJavaObject>("getInstance");
if (plugin != null)
{
plugin.Call("startSensorListening", "ambienttemperature");
}
}
source
share