Android/端末情報
提供: 初心者エンジニアの簡易メモ
// キャリア判別 TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String carrier = tm.getSimOperator(); if (carrier != null && carrier.length() > 0) { Log.i("test", "carrier=" + carrier); // DOCOMO: 44010 SoftBank: 44020 Au: 44070 } // 言語表示 Locale locale = Locale.getDefault(); String language = locale.getLanguage(); String country = locale.getCountry(); Log.i("test", "language=" + language); // ja Log.i("test", "country=" + country); // JP Log.i("test", "lang=" + Locale.getDefault().toString()); // ja_JP
// package_name取得(com.example.test.myapplication Log.i("test", "package_name=" + getApplication().getPackageName().toLowerCase()); // 端末名(404KC Log.i("test", Build.MODEL);
// 画面幅サイズ Point point = new Point(); // Android 3.2~ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { WindowManager wm = (WindowManager) context.getSystemService(WINDOW_SERVICE); Display disp = wm.getDefaultDisplay(); disp.getSize(point); } Log.i("test", "x=" + point.x); Log.i("test", "y=" + point.y);