For cross-platform Projects, use the UNITY_ANDROID define directive to conditionally compile Android-specific C# code. For more information, refer to Platform dependent compilation.
Applications can access most features of an Android device through the Input and Handheld classes. For more information, see:
To trigger a vibration, call Handheld.Vibrate. Devices without vibration hardware ignore this call.
Mobile operating systems have built-in activity indicators your application can use during slow operations. For more information, refer to Handheld.StartActivityIndicator.
To access device-specific properties, use these APIs:
| 스크립트 | 기기 프로퍼티 |
|---|---|
| SystemInfo.deviceUniqueIdentifier | 항상 ANDROID_ID의 md5를 반환합니다. 자세한 내용은 ANDROID_ID에 대한 Android 개발자 문서를 참조하십시오. |
| SystemInfo.deviceName | 기기 이름입니다. Android 기기의 경우 Unity는 안전 시스템 설정에서 device_name과 bluetooth_name을 읽으려고 시도합니다. 이 문자열에 값이 없으면 Unity는 <unknown>을 반환합니다. |
| SystemInfo.deviceModel | 기기 모델을 반환합니다. 여기에는 종종 제조사 이름과 모델 번호(예: “LGE Nexus 5 또는 ”SAMSUNG-SM-G900A")가 포함됩니다. |
| SystemInfo.operatingSystem | 운영체제 이름과 버전을 반환합니다. |