Skip to content

katapad/UnityAndroidDeviceStatus

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
app
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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);
}

About

read temperature and battery level

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages