Java code
- /**
- * Get Android currently available memory size
- */
- private String getavailmemory () {//Get Android Current available memory size
- Activitymanager am = (activitymanager) getsystemservice (Context.activity_service);
- Memoryinfo mi = new Memoryinfo ();
- Am.getmemoryinfo (MI);
- //mi.availmem; available memory for the current system
- return Formatter.formatfilesize (Getbasecontext (), MI.AVAILMEM); //Normalize the acquired memory size
- }
- /**
- * Get total system memory
- */
- Private String gettotalmemory () {
- String str1 = "/proc/meminfo"; System memory information file
- String str2;
- String[] arrayofstring;
- long initial_memory = 0;
- try {
- FileReader Localfilereader = new FileReader (STR1);
- BufferedReader Localbufferedreader = new BufferedReader (
- Localfilereader, 8192);
- STR2 = Localbufferedreader.readline (); //Read Meminfo first line, total system memory size
- arrayofstring = Str2.split ("\\s+");
- For (String num:arrayofstring) {
- LOG.I (str2, num + "\ t");
- }
- Initial_memory = integer.valueof (arrayofstring[1]). Intvalue () * 1024x768; Gets the total system memory, in kilobytes, multiplied by 1024 to byte
- Localbufferedreader.close ();
- } catch (IOException e) {
- }
- return Formatter.formatfilesize (Getbasecontext (), initial_memory); //byte converted to KB or MB, memory size normalized
- }
- /**
- * Get phone screen width high
- * @return
- */
- Public String Getheightandwidth () {
- int Width=getwindowmanager (). Getdefaultdisplay (). GetWidth ();
- int Heigth=getwindowmanager (). Getdefaultdisplay (). GetHeight ();
- String str=width+ "" +heigth+ "";
- return str;
- }
- /**
- * Get IMEI number, Iesi number, phone model
- */
- Private void GetInfo () {
- Telephonymanager mTm = (telephonymanager)this.getsystemservice (Telephony_service);
- String IMEI = Mtm.getdeviceid ();
- String IMSI = Mtm.getsubscriberid ();
- String mtype = Android.os.Build.MODEL; //Phone model
- String mtyb= Android.os.Build.BRAND; //Mobile brand
- String Numer = Mtm.getline1number (); //Mobile phone number, some can get, some can't get
- LOG.I ("text", "phone IMEI number:" +imei+"mobile phone Iesi number:" +imsi+"phone model:" +mtype+"mobile phone Brand:" +mtyb+"mobile phone number +numer);
- }
- /**
- *. Get phone MAC Address
- * Only the phone turns on WiFi to get the MAC address
- */
- Private String getmacaddress () {
- String result = "";
- Wifimanager Wifimanager = (wifimanager) getsystemservice (Context.wifi_service);
- Wifiinfo wifiinfo = Wifimanager.getconnectioninfo ();
- result = Wifiinfo.getmacaddress ();
- LOG.I ("text", "cell phone Macadd:" + result);
- return result;
- }
- /**
- * Mobile CPU Information
- */
- Private string[] Getcpuinfo () {
- String str1 = "/proc/cpuinfo";
- String str2 = "";
- String[] CpuInfo = {"", ""}; //1-CPU model//2-CPU frequency
- String[] arrayofstring;
- try {
- FileReader FR = new FileReader (STR1);
- BufferedReader Localbufferedreader = new BufferedReader (FR, 8192);
- STR2 = Localbufferedreader.readline ();
- arrayofstring = Str2.split ("\\s+");
- For (int i = 2; i < arrayofstring.length; i++) {
- cpuinfo[0] = cpuinfo[0] + arrayofstring[i] + "";
- }
- STR2 = Localbufferedreader.readline ();
- arrayofstring = Str2.split ("\\s+");
- cpuinfo[1] + = arrayofstring[2];
- Localbufferedreader.close ();
- } catch (IOException e) {
- }
- LOG.I ("text", "Cpuinfo:" + cpuinfo[0] + "" + cpuinfo[1]);
- return cpuInfo;
- }
Java code
- <!--get MAC address permissions--
- <uses-permission android:name="Android.permission.ACCESS_WIFI_STATE"/>
- <!--get Mobile information right--
- <uses-permission android:name="Android.permission.READ_PHONE_STATE"/>
Get basic information about Android phones