Get version information : Version « Hardware « Android

Home
Android
1.2D Graphics
2.Animation
3.Core Class
4.Database
5.Date Type
6.Development
7.File
8.Game
9.Hardware
10.Media
11.Network
12.Security
13.UI
14.User Event
Android » Hardware » Version 




Get version information
 

package app.test;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

import android.app.ActivityManager;
import android.app.ActivityManager.RunningServiceInfo;
import android.app.ActivityManager.RunningTaskInfo;
import android.content.Context;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.util.Log;

class CMDExecute {

  public synchronized String run(String[] cmd, String workdirectory)
      throws IOException {
    String result = "";

    try {
      ProcessBuilder builder = new ProcessBuilder(cmd);
      // set working directory
      if (workdirectory != null)
        builder.directory(new File(workdirectory));
      builder.redirectErrorStream(true);
      Process process = builder.start();
      InputStream in = process.getInputStream();
      byte[] re = new byte[1024];
      while (in.read(re!= -1) {
        System.out.println(new String(re));
        result = result + new String(re);
      }
      in.close();

    catch (Exception ex) {
      ex.printStackTrace();
    }
    return result;
  }

}

public class Main {
  private static StringBuffer buffer;


  public static String fetch_version_info() {
    String result = null;
    CMDExecute cmdexe = new CMDExecute();
    try {
      String[] args = "/system/bin/cat""/proc/version" };
      result = cmdexe.run(args, "/system/bin/");
    catch (IOException ex) {
      ex.printStackTrace();
    }
    return result;
  }
}

   
  














Related examples in the same category
1.Honeycomb version
2.Check Android build version
3.Using VersionedGestureDetector
4.downloads and installs the latest version of our App
5.Get App Version Name
6.Get App Version Code
7.Get Version Name with PackageManager
8.Get Package Version Code and Name
9.Android SDK version
10.Check for intallation, app name, app version, app version code
11.Get version number
12.Utility class providing array to int/long conversion for data received from devices through adb.
13.get Version Name
14.get Version Code
15.Byte value conversion
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.