How to get android version of my device programmatically when debugging via usb? I saw a link with this line of code but I reckon this gets the build/version number of the app and not that of the OS of the actual device
packageinfo = getPackageManager().getPackageInfo(getPackageName(), 0);
Version = packageinfo.versionName.toString();
in my code this is what I have for application names etc , within here I would like to get android version of the actual device I am using to debug(Samsung GT-I9300)
MY CODE
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;
}