A blog for technology, SEO tips, website development and open source programming.

Get Android system info

0 925

The post will indicates how to get the Android System info. The source code is very simple, The above picture shows the information extracted from the android system .

Copy and paste the following code inside your activity


import android.app.Activity;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle;
import android.view.Menu;
import android.widget.TextView;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_main);
TextView infoView = new TextView(this);
setContentView(infoView);
WifiManager myWifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
WifiInfo myWifiInfo = myWifiManager.getConnectionInfo();
int ipAddress = myWifiInfo.getIpAddress();
System.out.println(“WiFi address is ”
+ android.text.format.Formatter.formatIpAddress(ipAddress));

String info = “System Info:n”.toUpperCase();

info += “BOARD: ” + Build.BOARD + “n” + “BOOTLOADER: ”
+ Build.BOOTLOADER + “n” + “BRAND: ” + Build.BRAND + “n”
+ “CPU_ABI: ” + Build.CPU_ABI + “n” + “CPU_ABI2: ”
+ Build.CPU_ABI2 + “n” + “DEVICE: ” + Build.DEVICE + “n”
+ “DISPLAY: ” + Build.DISPLAY + “n” + “FINGERPRINT: ”
+ Build.FINGERPRINT + “n” + “HARDWARE: ” + Build.HARDWARE
+ “n” + “HOST: ” + Build.HOST + “n” + “ID: ” + Build.ID
+ “n” + “MANUFACTURER: ” + Build.MANUFACTURER + “n”
+ “MODEL: ” + Build.MODEL + “n” + “PRODUCT: ” + Build.PRODUCT
+ “n” + “SERIAL: ” + Build.SERIAL + “n” + “TAGS: ”
+ Build.TAGS + “n” + “TIME: ” + Build.TIME + “n” + “TYPE: ”
+ Build.TYPE + “n” + “USER: ” + Build.USER + “n”
+ “My IP Address:” + ipAddress + “n” + “Network ID: ”
+ myWifiInfo.getNetworkId() + “n” + “Mac Address: ”
+ myWifiInfo.getMacAddress() + “n” + “SSID: ”
+ myWifiInfo.getSSID() + “n”

+ “RadioVersion: ” + Build.getRadioVersion() + “n” + ” n”;

infoView.setText(info);
}

Now inside your manifest add:

<uses-permission android:name=”android.permission.INTERNET” />

<uses-permission android:name=”android.permission.ACCESS_WIFI_STATE” />

Leave a Reply

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More