AndroidでSystemPropertiesがどこまで利用可能か調べてみた
一覧は公式ページに乗っているName | Meaning | Example |
file.separator | separator | / |
java.class.path | System class path | . |
java.class.version | (Not useful on Android) | 50.0 |
java.compiler | (Not useful on Android) | Empty |
java.ext.dirs | (Not useful on Android) | Empty |
java.home | Location of the VM on the file system | /system |
java.io.tmpdir | See createTempFile(String, String) | /sdcard |
java.library.path | Search path for JNI libraries | /vendor/lib:/system/lib |
java.vendor | Human-readable VM vendor | The Android Project |
java.vendor.url | URL for VM vendor's web site | http://www.android.com/ |
java.version | (Not useful on Android) | 0 |
java.specification.version | VM libraries version | 0.9 |
java.specification.vendor | VM libraries vendor | The Android Project |
java.specification.name | VM libraries name | Dalvik Core Library |
java.vm.version | VM implementation version | 1.2.0 |
java.vm.vendor | VM implementation vendor | The Android Project |
java.vm.name | VM implementation name | Dalvik |
java.vm.specification.version | VM specification version | 0.9 |
java.vm.specification.vendor | VM specification vendor | The Android Project |
java.vm.specification.name | VM specification name | Dalvik Virtual Machine Specification |
line.separator | The system line separator | \n |
os.arch | OS architecture | armv7l |
os.name | OS (kernel) name | Linux |
os.version | OS (kernel) version | 2.6.32.9-g103d848 |
path.separator | See pathSeparator | : |
user.dir | Base of non-absolute paths | / |
user.home | (Not useful on Android) | Empty |
user.name | (Not useful on Android) | Empty |
が、実際どうなのかやってみた。
以下サンプルアプリを作成。
まずは、エミュレータで確認。
↓使用するエミュレータ
↓LogCatの内容
01-17 23:21:59.126: D/MainActivity(2642): key = http.agent, value = Dalvik/2.0.0 (Linux; U; Android L Build/LPV81B)
01-17 23:21:59.154: D/MainActivity(2642): key = java.io.tmpdir, value = /data/data/com.examples.androidmics/cache
01-17 23:21:59.156: D/MainActivity(2642): Line :
・・・少なっ!!
エミュレータだとこんなもんなんでしょうか。。
次に実機で確認。
Android4.0.4
02-06 08:02:32.090: D/MainActivity(1375): key = java.vm.version, value = 1.6.0
02-06 08:02:32.090: D/MainActivity(1375): key = android.icu.library.version, value = 4.6
02-06 08:02:32.090: D/MainActivity(1375): key = java.vendor.url, value = http://www.android.com/
02-06 08:02:32.090: D/MainActivity(1375): key = java.vm.vendor.url, value = http://www.android.com/
02-06 08:02:32.090: D/MainActivity(1375): key = user.dir, value = /
02-06 08:02:32.090: D/MainActivity(1375): key = java.vm.name, value = Dalvik
02-06 08:02:32.090: D/MainActivity(1375): key = java.home, value = /system
02-06 08:02:32.090: D/MainActivity(1375): key = user.region, value = JP
02-06 08:02:32.090: D/MainActivity(1375): key = android.zlib.version, value = 1.2.5
02-06 08:02:32.090: D/MainActivity(1375): key = user.home, value =
02-06 08:02:32.090: D/MainActivity(1375): key = java.runtime.name, value = Android Runtime
02-06 08:02:32.090: D/MainActivity(1375): key = java.io.tmpdir, value = /sdcard
02-06 08:02:32.090: D/MainActivity(1375): key = http.agent, value = Dalvik/1.6.0 (Linux; U; Android 4.0.4; AT1S0 Build/IMM76D)
02-06 08:02:32.090: D/MainActivity(1375): key = java.version, value = 0
02-06 08:02:32.090: D/MainActivity(1375): key = java.boot.class.path, value = /system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/filterfw.jar
02-06 08:02:32.090: D/MainActivity(1375): key = java.library.path, value = /vendor/lib:/system/lib
02-06 08:02:32.090: D/MainActivity(1375): key = file.separator, value = /
02-06 08:02:32.090: D/MainActivity(1375): key = java.specification.vendor, value = The Android Project
02-06 08:02:32.090: D/MainActivity(1375): key = file.encoding, value = UTF-8
02-06 08:02:32.090: D/MainActivity(1375): key = line.separator, value =
02-06 08:02:32.090: D/MainActivity(1375): key = java.vm.specification.version, value = 0.9
02-06 08:02:32.090: D/MainActivity(1375): key = java.vm.specification.vendor, value = The Android Project
02-06 08:02:32.090: D/MainActivity(1375): key = android.openssl.version, value = OpenSSL 1.0.0e 6 Sep 2011
02-06 08:02:32.090: D/MainActivity(1375): key = os.name, value = Linux
02-06 08:02:32.090: D/MainActivity(1375): key = java.vm.vendor, value = The Android Project
02-06 08:02:32.090: D/MainActivity(1375): key = path.separator, value = :
02-06 08:02:32.090: D/MainActivity(1375): key = java.ext.dirs, value =
02-06 08:02:32.090: D/MainActivity(1375): key = java.class.path, value = .
02-06 08:02:32.090: D/MainActivity(1375): key = os.version, value = 2.6.39.4-g8e40b1f
02-06 08:02:32.090: D/MainActivity(1375): key = java.specification.name, value = Dalvik Core Library
02-06 08:02:32.090: D/MainActivity(1375): key = java.compiler, value =
02-06 08:02:32.090: D/MainActivity(1375): key = os.arch, value = armv7l
02-06 08:02:32.090: D/MainActivity(1375): key = user.name, value =
02-06 08:02:32.090: D/MainActivity(1375): key = user.language, value = ja
02-06 08:02:32.090: D/MainActivity(1375): key = android.icu.unicode.version, value = 6.0
02-06 08:02:32.090: D/MainActivity(1375): key = java.runtime.version, value = 0.9
02-06 08:02:32.090: D/MainActivity(1375): key = java.class.version, value = 50.0
02-06 08:02:32.090: D/MainActivity(1375): key = java.vendor, value = The Android Project
02-06 08:02:32.090: D/MainActivity(1375): key = java.vm.specification.name, value = Dalvik Virtual Machine Specification
02-06 08:02:32.090: D/MainActivity(1375): key = java.specification.version, value = 0.9
02-06 08:02:32.090: D/MainActivity(1375): Line :
公式ページと同じくらいのプロパティが設定してあるよう。
ちなみに、System#getPropertyで存在しないキーを指定するとnullを返却するので、
nullチェックは必要!!
0 件のコメント:
コメントを投稿