Quantcast
Channel: silveira neto » Java
Viewing all articles
Browse latest Browse all 11

Getting enviroment information on Android

$
0
0

This is a simple program I wrote called Who Am I that shows informations about the device which it is running. Which can be useful for developers and maybe advanced users.

Download:

  • WhoAmI.tar.bz2 – Eclipse project. It’s configured for Android platform 4 (1.6) but should work without problems in newer Android platform versions.
  • WhoAmI.apk – Application installation Android package.

Main Activity source code:

package net.silveiraneto.whoami;
 
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.widget.EditText;
 
public class WhoAmI extends Activity {
    private EditText mEditor;
 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
 
        setContentView(R.layout.whoami);
 
        mEditor = (EditText) findViewById(R.id.editor);
 
        Object[][] properties = {
        	{"Build.BOARD", Build.BOARD},
        	{"Build.BRAND", Build.BRAND},
        	{"Build.CPU_ABI", Build.CPU_ABI},
        	{"Build.DEVICE", Build.DEVICE},
        	{"Build.DISPLAY", Build.DISPLAY},
        	{"Build.FINGERPRINT", Build.FINGERPRINT},
        	{"Build.HOST", Build.HOST},
        	{"Build.ID", Build.ID},
        	{"Build.MANUFACTURER", Build.MANUFACTURER},
        	{"Build.MODEL", Build.MODEL},
        	{"Build.PRODUCT", Build.PRODUCT},
        	{"Build.TAGS", Build.TAGS},
        	{"Build.TIME", Build.TIME},
        	{"Build.USER", Build.USER},
        };
 
        for(Object[] prop: properties) {
        	mEditor.append(String.format("%s: %s\n", prop[0], prop[1]));
        }
    }
}

And its Android Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="net.silveiraneto.whoami">
    <application android:label="Who Am I">
        <activity android:name="WhoAmI">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

Viewing all articles
Browse latest Browse all 11

Trending Articles