├── .classpath
├── .project
├── AndroidManifest.xml
├── README.markdown
├── default.properties
├── key_store
├── res
├── drawable
│ └── icon.png
├── layout
│ └── main.xml
├── values-12key
│ └── strings.xml
├── values-dpad
│ └── strings.xml
├── values-finger
│ └── strings.xml
├── values-hdpi
│ └── strings.xml
├── values-keysexposed
│ └── strings.xml
├── values-keyssoft
│ └── strings.xml
├── values-large
│ └── strings.xml
├── values-ldpi
│ └── strings.xml
├── values-long
│ └── strings.xml
├── values-mdpi
│ └── strings.xml
├── values-nodpi
│ └── strings.xml
├── values-nokeys
│ └── strings.xml
├── values-nonav
│ └── strings.xml
├── values-normal
│ └── strings.xml
├── values-notlong
│ └── strings.xml
├── values-notouch
│ └── strings.xml
├── values-qwerty
│ └── strings.xml
├── values-small
│ └── strings.xml
├── values-stylus
│ └── strings.xml
├── values-trackball
│ └── strings.xml
├── values-wheel
│ └── strings.xml
├── values-xhdpi
│ └── strings.xml
├── values-xlarge
│ └── strings.xml
└── values
│ └── strings.xml
└── src
└── com
└── menny
└── android
└── deviceinformation
└── Main.java
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | AndroidDeviceInformation
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
24 |
--------------------------------------------------------------------------------
/README.markdown:
--------------------------------------------------------------------------------
1 | A simple Android device information application.
2 |
3 | ## Features
4 |
5 | Shows static information about the device, like screen size (small, medium, large, etc), pixel density, OS version, etc.
6 |
7 | There are different features I want to add. This is a live list of what's pending and what's done:
8 |
9 | ## Install
10 |
11 | Install, and run. Then you'll have an option to e-mail the report by pressing 'Menu' key.
12 |
13 | ## Who is _Menny_?
14 | You can read all about me here: http://www.evendanan.net
15 | See the source code at http://github.com/menny
--------------------------------------------------------------------------------
/default.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system use,
7 | # "build.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | # Project target.
11 | target=android-10
12 |
--------------------------------------------------------------------------------
/key_store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/menny/android-device-info/e07ecd7009d42bfaee4bf496163b79bc3b87d2f5/key_store
--------------------------------------------------------------------------------
/res/drawable/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/menny/android-device-info/e07ecd7009d42bfaee4bf496163b79bc3b87d2f5/res/drawable/icon.png
--------------------------------------------------------------------------------
/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
10 |
11 |
12 |
13 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/res/values-12key/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 12keys
4 |
5 |
--------------------------------------------------------------------------------
/res/values-dpad/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | dpad
4 |
5 |
--------------------------------------------------------------------------------
/res/values-finger/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | finger
4 |
5 |
--------------------------------------------------------------------------------
/res/values-hdpi/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | hdpi
4 | hdpi
5 |
6 |
--------------------------------------------------------------------------------
/res/values-keysexposed/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | keysexposed
4 |
5 |
--------------------------------------------------------------------------------
/res/values-keyssoft/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | keysoft
4 |
5 |
--------------------------------------------------------------------------------
/res/values-large/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | large
4 | large
5 |
6 |
--------------------------------------------------------------------------------
/res/values-ldpi/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | ldpi
4 | ldpi
5 |
6 |
--------------------------------------------------------------------------------
/res/values-long/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | long
4 |
5 |
--------------------------------------------------------------------------------
/res/values-mdpi/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | mdpi
4 | mdpi
5 |
6 |
--------------------------------------------------------------------------------
/res/values-nodpi/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | nodpi
4 |
5 |
--------------------------------------------------------------------------------
/res/values-nokeys/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | nokeys
4 |
5 |
--------------------------------------------------------------------------------
/res/values-nonav/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | nonav
4 |
5 |
--------------------------------------------------------------------------------
/res/values-normal/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | normal
4 | normal
5 |
6 |
--------------------------------------------------------------------------------
/res/values-notlong/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | notlong
4 |
5 |
--------------------------------------------------------------------------------
/res/values-notouch/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | notouch
4 |
5 |
--------------------------------------------------------------------------------
/res/values-qwerty/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | qwerty
4 |
5 |
--------------------------------------------------------------------------------
/res/values-small/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | small
4 | small
5 |
6 |
--------------------------------------------------------------------------------
/res/values-stylus/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | stylus
4 |
5 |
--------------------------------------------------------------------------------
/res/values-trackball/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | trackball
4 |
5 |
--------------------------------------------------------------------------------
/res/values-wheel/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | wheel
4 |
5 |
--------------------------------------------------------------------------------
/res/values-xhdpi/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | xhdpi
4 | xhdpi
5 |
6 |
--------------------------------------------------------------------------------
/res/values-xlarge/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | xlarge
4 | xlarge
5 |
6 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | ASK Device Information
4 | no
5 | no
6 | no
7 | no
8 | no
9 | no
10 | no
11 | no
12 | no
13 | no
14 | no
15 | no
16 | no
17 | no
18 |
19 | no
20 | no
21 | no
22 | no
23 | no
24 | none
25 |
26 | no
27 | no
28 | no
29 | no
30 | none
31 |
32 |
--------------------------------------------------------------------------------
/src/com/menny/android/deviceinformation/Main.java:
--------------------------------------------------------------------------------
1 | package com.menny.android.deviceinformation;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.content.pm.PackageInfo;
6 | import android.content.pm.PackageManager;
7 | import android.content.pm.PackageManager.NameNotFoundException;
8 | import android.graphics.Typeface;
9 | import android.graphics.drawable.Drawable;
10 | import android.os.Bundle;
11 | import android.os.Handler;
12 | import android.util.DisplayMetrics;
13 | import android.view.View;
14 | import android.view.View.OnClickListener;
15 | import android.widget.Button;
16 | import android.widget.ImageView;
17 | import android.widget.LinearLayout;
18 | import android.widget.TextView;
19 |
20 | public class Main extends Activity implements OnClickListener {
21 | private String mReport = "Empty";
22 | private LinearLayout mLayout;
23 | private String mAppName = "Device info";
24 |
25 | private static final String[] PACKAGES = new String[]{
26 | "com.menny.android.anysoftkeyboard"
27 | };
28 |
29 | private static final String[] SEND_TO_EMAIL = new String[]{
30 | "ask@evendanan.net"
31 | };
32 |
33 | /** Called when the activity is first created. */
34 | @Override
35 | public void onCreate(Bundle savedInstanceState) {
36 | super.onCreate(savedInstanceState);
37 | setContentView(R.layout.main);
38 | mLayout = (LinearLayout)findViewById(R.id.layout);
39 | mReport = "Device information report:\n";
40 | try {
41 | PackageInfo info = super.getApplication().getPackageManager().getPackageInfo(getApplication().getPackageName(), 0);
42 | mAppName = "Device Info v"+info.versionName+"("+info.versionCode+")";
43 | setTextOfLabel(true, mAppName);
44 | for(String pkg : PACKAGES)
45 | {
46 | setTextOfLabel(false, getPkgVersion(pkg));
47 | }
48 |
49 | setTextOfLabel(false, "Locale: "+getResources().getConfiguration().locale.toString());
50 | setTextOfLabel(true, "** Device:");
51 | setTextOfLabel(false, "Board: "+android.os.Build.BOARD);
52 | setTextOfLabel(false, "Brand: "+android.os.Build.BRAND);
53 | setTextOfLabel(false, "Device: "+android.os.Build.DEVICE);
54 | setTextOfLabel(false, "Model: "+android.os.Build.MODEL);
55 | setTextOfLabel(false, "Product: "+android.os.Build.PRODUCT);
56 | setTextOfLabel(false, "TAGS: "+android.os.Build.TAGS);
57 |
58 | setTextOfLabel(true, "** OS:");
59 | setTextOfLabel(false, "Build release "+android.os.Build.VERSION.RELEASE + ", Inc: '"+android.os.Build.VERSION.INCREMENTAL+"'");
60 | setTextOfLabel(false, "Display build: "+android.os.Build.DISPLAY);
61 | setTextOfLabel(false, "Finger print: "+android.os.Build.FINGERPRINT);
62 | setTextOfLabel(false, "Build ID: "+android.os.Build.ID);
63 | setTextOfLabel(false, "Time: "+android.os.Build.TIME);
64 | setTextOfLabel(false, "Type: "+android.os.Build.TYPE);
65 | setTextOfLabel(false, "User: "+android.os.Build.USER);
66 |
67 | setTextOfLabel(true, "** Density:");
68 | DisplayMetrics metrics = new DisplayMetrics();
69 | getWindowManager().getDefaultDisplay().getMetrics(metrics);
70 | setTextOfLabel(false, "density: "+metrics.density);
71 | setTextOfLabel(false, "densityDpi: "+metrics.densityDpi);
72 | setTextOfLabel(false, "scaledDensity: "+metrics.scaledDensity);
73 | setTextOfLabel(false, "xdpi: "+metrics.xdpi);
74 | setTextOfLabel(false, "ydpi: "+metrics.ydpi);
75 | setTextOfLabel(true, "** Density reference:");
76 | setTextOfLabel(false, "DENSITY_DEFAULT: "+DisplayMetrics.DENSITY_DEFAULT);
77 | setTextOfLabel(false, "DENSITY_LOW: "+DisplayMetrics.DENSITY_LOW);
78 | setTextOfLabel(false, "DENSITY_MEDIUM: "+DisplayMetrics.DENSITY_MEDIUM);
79 | setTextOfLabel(false, "DENSITY_HIGH: "+DisplayMetrics.DENSITY_HIGH);
80 |
81 | setTextOfLabel(true, "** Screen:");
82 | setTextOfLabel(false, "heightPixels: "+metrics.heightPixels);
83 | setTextOfLabel(false, "widthPixels: "+metrics.widthPixels);
84 |
85 |
86 | setTextOfLabel(true, "** Resources:");
87 | setTextOfResource("values-nokeys", R.string.nokeys);
88 | setTextOfResource("values-12key", R.string.keys12);
89 | setTextOfResource("values-qwerty", R.string.qwerty);
90 | setTextOfResource("values-dpad", R.string.dpad);
91 | setTextOfResource("values-nonav", R.string.nonav);
92 | setTextOfResource("values-trackball", R.string.trackball);
93 | setTextOfResource("values-wheel", R.string.wheel);
94 | setTextOfResource("values-stylus", R.string.stylus);
95 | setTextOfResource("values-finger", R.string.finger);
96 | setTextOfResource("values-notouch", R.string.notouch);
97 |
98 | setTextOfResource("values-nodpi", R.string.nodpi);
99 | setTextOfResource("values-ldpi", R.string.ldpi);
100 | setTextOfResource("values-mdpi", R.string.mdpi);
101 | setTextOfResource("values-hdpi", R.string.hdpi);
102 | setTextOfResource("values-xhdpi", R.string.xhdpi);
103 | setTextOfResource("prefered density", R.string.pref_pdi);
104 |
105 | setTextOfResource("values-small", R.string.small);
106 | setTextOfResource("values-normal", R.string.normal);
107 | setTextOfResource("values-large", R.string.large);
108 | setTextOfResource("values-xlarge", R.string.xlarge);
109 | setTextOfResource("prefered screen", R.string.pref_screen);
110 |
111 | setTextOfResource("values-long", R.string.long_resource);
112 | setTextOfResource("values-notlong", R.string.notlong);
113 |
114 | setTextOfResource("values-keysexposed", R.string.keysexposed);
115 | setTextOfResource("values-keyssoft", R.string.keysoft);
116 |
117 | new Handler().postDelayed(new Runnable() {
118 |
119 | @Override
120 | public void run() {
121 | setTextOfLabel(true, "** Drawable:");
122 | setTextOfLabel(false, "icon original width: 48");
123 | setTextOfLabel(false, "icon original height: 48");
124 | ImageView i = (ImageView)findViewById(R.id.app_icon_view);
125 | setTextOfLabel(false, "icon actual width: "+i.getWidth());
126 | setTextOfLabel(false, "icon actual height: "+i.getHeight());
127 |
128 | Button sendEmail = new Button(Main.this);
129 | sendEmail.setText("Send report...");
130 | sendEmail.setOnClickListener(Main.this);
131 | mLayout.addView(sendEmail);
132 | }
133 | },250);
134 | } catch (Exception e) {
135 | e.printStackTrace();
136 | setTextOfLabel(true, "Exception: "+e.toString());
137 | }
138 | }
139 |
140 | private void setTextOfResource(String resName, int resId) {
141 | setTextOfLabel(false, String.format("%s : %s", resName, getText(resId)));
142 | }
143 |
144 | private String getPkgVersion(String packageName) {
145 | try {
146 | PackageInfo info = getApplication().getPackageManager().getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
147 | return packageName+" "+info.versionName+" ("+info.versionCode+")";
148 | } catch (NameNotFoundException e) {
149 | return "Failed to get '"+packageName+"' info: "+e.getMessage();
150 | }
151 | }
152 |
153 | private void setTextOfLabel(boolean bold, String text)
154 | {
155 | TextView label = new TextView(this);
156 | label.setText(text);
157 | label.setTypeface(Typeface.DEFAULT, bold?Typeface.BOLD : Typeface.NORMAL);
158 | mLayout.addView(label);
159 | mReport = mReport + "\n" + text;
160 | }
161 |
162 | @Override
163 | public void onClick(View arg0) {
164 | /* Create the Intent */
165 | final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
166 |
167 | /* Fill it with Data */
168 | emailIntent.setType("plain/text");
169 | emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, SEND_TO_EMAIL);
170 | emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, mAppName);
171 | emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, mReport);
172 | //emailIntent.putExtra(Intent.EXTRA_STREAM, u);
173 | /* Send it off to the Activity-Chooser */
174 | this.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
175 | }
176 | }
--------------------------------------------------------------------------------