Skip to content

Getting enviroment information on Android

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:



    
        
            
                
                
            
        
    

Published inenglish

8 Comments

  1. Peguei um force close no G1 dev phone, rodando Android 1.5:
    03-16 15:31:20.401: DEBUG/HomeLoaders(111): –> add package
    03-16 15:31:20.501: WARN/ResourceType(56): No package identifier when getting value for resource number 0x7f060001
    03-16 15:31:20.511: WARN/InputManagerService(56): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@436e1ab8 (uid=10012 pid=467)
    03-16 15:31:21.191: INFO/ActivityManager(56): Displayed activity com.android.packageinstaller/.InstallAppDone: 798 ms
    03-16 15:31:21.241: DEBUG/VoiceDialerReceiver(475): onReceive Intent { action=android.intent.action.PACKAGE_ADDED data=package:net.silveiraneto.whoami comp={com.android.voicedialer/com.android.voicedialer.VoiceDialerReceiver} (has extras) }
    03-16 15:31:21.332: DEBUG/RecognizerEngine(475): deleteCachedGrammarFiles /data/data/com.android.voicedialer/files/openentries.txt
    03-16 15:31:21.451: INFO/ActivityManager(56): Start proc com.android.vending for broadcast com.android.vending/.PackageMonitorReceiver: pid=481 uid=10002 gids={3003}
    03-16 15:31:21.631: INFO/ActivityManager(56): Process com.android.voicedialer (pid 475) has died.
    03-16 15:31:22.041: INFO/ActivityManager(56): Starting activity: Intent { action=android.intent.action.MAIN flags=0x10000000 comp={net.silveiraneto.whoami/net.silveiraneto.whoami.WhoAmI} }
    03-16 15:31:22.211: INFO/ActivityManager(56): Start proc net.silveiraneto.whoami for activity net.silveiraneto.whoami/.WhoAmI: pid=487 uid=10035 gids={}
    03-16 15:31:22.551: DEBUG/dalvikvm(487): DexOpt: couldn’t find static field
    03-16 15:31:22.551: WARN/dalvikvm(487): VFY: unable to resolve static field 2 (CPU_ABI) in Landroid/os/Build;
    03-16 15:31:22.551: WARN/dalvikvm(487): VFY: rejecting opcode 0x62 at 0x0037
    03-16 15:31:22.551: WARN/dalvikvm(487): VFY: rejected Lnet/silveiraneto/whoami/WhoAmI;.onCreate (Landroid/os/Bundle;)V
    03-16 15:31:22.551: WARN/dalvikvm(487): Verifier rejected class Lnet/silveiraneto/whoami/WhoAmI;
    03-16 15:31:22.551: WARN/dalvikvm(487): Class init failed in newInstance call (Lnet/silveiraneto/whoami/WhoAmI;)
    03-16 15:31:22.551: DEBUG/AndroidRuntime(487): Shutting down VM
    03-16 15:31:22.551: WARN/dalvikvm(487): threadid=3: thread exiting with uncaught exception (group=0x4000fe70)
    03-16 15:31:22.561: ERROR/AndroidRuntime(487): Uncaught handler: thread main exiting due to uncaught exception
    03-16 15:31:22.621: INFO/ActivityManager(56): Process com.google.android.apps.maps (pid 202) has died.
    03-16 15:31:22.711: INFO/ActivityThread(481): Publishing provider com.android.vending.SuggestionsProvider: com.android.vending.SuggestionsProvider
    03-16 15:31:22.901: ERROR/AndroidRuntime(487): java.lang.VerifyError: net.silveiraneto.whoami.WhoAmI
    03-16 15:31:22.901: ERROR/AndroidRuntime(487): at java.lang.Class.newInstanceImpl(Native Method)
    03-16 15:31:22.901: ERROR/AndroidRuntime(487): at java.lang.Class.newInstance(Class.java:1472)
    03-16 15:31:22.901: ERROR/AndroidRuntime(487): at android.app.Instrumentation.newActivity(Instrumentation.java:1097)
    03-16 15:31:22.901: ERROR/AndroidRuntime(487): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2186)
    03-16 15:31:22.901: ERROR/AndroidRuntime(487): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
    03-16 15:31:22.901: ERROR/AndroidRuntime(487): at android.app.ActivityThread.access$1800(ActivityThread.java:112)
    03-16 15:31:22.901: ERROR/AndroidRuntime(487): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
    03-16 15:31:22.901: ERROR/AndroidRuntime(487): at android.os.Handler.dispatchMessage(Handler.java:99)
    03-16 15:31:22.901: ERROR/AndroidRuntime(487): at android.os.Looper.loop(Looper.java:123)
    03-16 15:31:22.901: ERROR/AndroidRuntime(487): at android.app.ActivityThread.main(ActivityThread.java:3948)
    03-16 15:31:22.901: ERROR/AndroidRuntime(487): at java.lang.reflect.Method.invokeNative(Native Method)
    03-16 15:31:22.901: ERROR/AndroidRuntime(487): at java.lang.reflect.Method.invoke(Method.java:521)
    03-16 15:31:22.901: ERROR/AndroidRuntime(487): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
    03-16 15:31:22.901: ERROR/AndroidRuntime(487): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
    03-16 15:31:22.901: ERROR/AndroidRuntime(487): at dalvik.system.NativeStart.main(Native Method)
    03-16 15:31:23.111: INFO/Process(56): Sending signal. PID: 487 SIG: 3
    03-16 15:31:23.111: INFO/dalvikvm(487): threadid=7: reacting to signal 3
    03-16 15:31:23.211: INFO/dalvikvm(487): Wrote stack trace to ‘/data/anr/traces.txt’
    03-16 15:31:24.561: INFO/CheckinService(56): Checkin triggered: Intent { action=android.server.checkin.CHECKIN (has extras) }, market only = true
    03-16 15:31:24.571: INFO/ActivityManager(56): Stopping service: com.android.vending/.PackageMonitorReceiver$UpdateCheckinDatabaseService
    03-16 15:31:24.691: INFO/CheckinService(56): Sending checkin request (920 bytes)…
    03-16 15:31:24.993: DEBUG/InetAddress(56): android.clients.google.com: 74.125.79.101 (family 2, proto 6)
    03-16 15:31:24.993: DEBUG/InetAddress(56): android.clients.google.com: 74.125.79.102 (family 2, proto 6)
    03-16 15:31:24.993: DEBUG/InetAddress(56): android.clients.google.com: 74.125.79.100 (family 2, proto 6)
    03-16 15:31:26.841: INFO/CheckinService(56): From server: Intent { action=android.server.checkin.FOTA_CANCEL }
    03-16 15:31:32.118: WARN/ActivityManager(56): Launch timeout has expired, giving up wake lock!
    03-16 15:31:32.431: WARN/ActivityManager(56): Activity idle timeout for HistoryRecord{4366e9e0 {net.silveiraneto.whoami/net.silveiraneto.whoami.WhoAmI}}
    03-16 15:31:37.611: DEBUG/dalvikvm(186): GC freed 3626 objects / 214728 bytes in 168ms
    03-16 15:31:42.561: DEBUG/MountListener(56): handleEvent ums_connected
    03-16 15:31:43.041: DEBUG/OpenSSLSessionImpl(56): Freeing OpenSSL session
    03-16 15:31:43.041: DEBUG/dalvikvm(56): GC freed 17364 objects / 918688 bytes in 276ms
    03-16 15:31:43.486: WARN/AudioFlinger(35): write blocked for 81 msecs

  2. Patola Patola

    Tem jeito de pegar o número do telefone no android? Isso é algo que poucas vezes funciona no N900 (Maemo 5).

    Aliás, vendo esses artigos sobre Android pipocando no br-linux e outros lugares, fico pensando que desperdício ver mentes tão brilhantes como por exemplo o Silveira e o Cabelo usando seus talentos em um ambiente que nada se parece com o Linux típico que usam.

  3. Savio Savio

    Silveira Neto,
    Tudo bom? Seria possível desenvolver uma aplicação que coletasse o tráfego 3G por cada aplicação e não total? Eu digo “alguém” porque eu não sei programar.
    Abraços,
    Sávio.

  4. Savio, seria bem interessante essa aplicação.
    Eu não sei como fazer para contar os dados por uma aplicação porque para contar os dados que foram trafegados usamos arquivos de contagem da estrutura de sistema de arquivos do Linux que o Android possui. Porém há alguns bons contadores de tráfego para Android mas sem essa granularidade que você quer.

  5. It’s so hard to get backlinks these days, honestly i need a backlink by comments on your blog / forums or guestbook to make my website appear in search engine. I am getting desperate Now! I know you’ll laugh while reading this comment !!! Here is my website vimax I know my comments do not relate to the topic, but PLEASE HELP ME!! APPROVING MY COMMENT!
    Regards: PoormanBH2011

Leave a Reply

Your email address will not be published. Required fields are marked *