read temperature and battery level
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
gradle/wrapper
unity_lib
.gitignore
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

Getting Started

make it.

$ ./gradlew assembleRelease
# ./unity_lib/build/outputs/aar/unity_lib-release.aar ← use it.

and use it.

add unity folder

/Assets/Plugins/Android/unity_lib-release.aar

Unity code

void Start() {
    AndroidJavaObject androidJavaObject = new AndroidJavaObject( "unity.util.bascule.co.jp.unity_lib.GetAndroidStatus" );
    int batteryLevel = androidJavaObject.CallStatic<int> ("BatteryLevel");
    int temperature = androidJavaObject.CallStatic<int> ("BatteryTemperature");
    Debug.Log ("batteryLevel: " + batteryLevel);
    Debug.Log ("temperature: " + temperature);
}