0
usb経由でデバッグするときにデバイスのアンドロイド版をプログラムで取得する方法はありますか?これは私がアプリケーション名のために持っているものです私のコードでUSB経由でデバッグする際、私のデバイスのアンドロイド版をプログラムで取得する方法
packageinfo = getPackageManager().getPackageInfo(getPackageName(), 0);
Version = packageinfo.versionName.toString();
私はこのコード行とのリンクを見ましたが、私は、これはアプリのビルド/バージョン番号を取得数えるなく、実際のデバイスのOSの
など、ここでの内、私はデバッグに(サムスンGT-I9300)を使用しています実際のデバイスのアンドロイドのバージョンを取得したいと思いMY CODEあなたはandroid.os.Build.VERSION.SDK_INT
を使用することができます
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = cm.getActiveNetworkInfo();
int networkType = NetworkState.GetNetworkState(context, info, "DataUsageRecorder"); // wifi, data, data roaming
// Get all apps
PackageManager pm = context.getPackageManager();
for (ApplicationInfo app : pm.getInstalledApplications(0))
{
long tx = 0;
long rx = 0;
int uid = app.uid;
tx = TrafficStats.getUidTxBytes(uid);
rx = TrafficStats.getUidRxBytes(uid);
if ((tx == 0 || rx == 0))
{
// Skip inactive items
continue;
}
else if (Globals.DEBUG && (tx < DEBUG_5MB && rx < DEBUG_5MB))
{
// Let's skip all the BS for quick testingFlog
continue;
}
私は本当にあなたがどのように検索したのかわかりません。しかし、多くの回答があります。このリンクをチェックするhttp://stackoverflow.com/questions/3423754/retrieving-android-api-version-programmatically – ljpv14