As I have refer the old post i.e. Android: Get Hardware Information Programmatically but didn't find any relavant answer and also tried to find the solution in google but all in vain. Please help me go forward
-
Offcourse I am aware of that, but there is no relavant answer for that post. Even I have already mentioned there.. You must check it out - @Bxtr – Rajat kumar Jul 06 '15 at 07:40
-
2If someone finds the answer, it should be added to the old question – no need to ask a duplicate. – Petr Viktorin Jul 06 '15 at 11:02
-
@petr Viktorin - thanks for your kind suggestion. – Rajat kumar Jul 06 '15 at 11:17
3 Answers
I recently setup such a thing... Upon registration, the phone sends to the webservice (with Retrofit) all the useful harware / software parameters I could find... Here is the relevant part of the code I used :
boolean isRooted = findBinary("su");
PackageInfo pInfo;
String version = "unknown";
try {
pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
version = pInfo.versionName;
} catch (NameNotFoundException e) {
e.printStackTrace();
}
myService.sendPhoneDetails(
android.os.Build.VERSION.SDK_INT,
android.os.Build.VERSION.RELEASE,
android.os.Build.BRAND,
android.os.Build.MANUFACTURER,
android.os.Build.MODEL,
android.os.Build.SERIAL,
isRooted,
version,
new Callback<Model>() {
@Override
public void success(Model model, Response response) {
// ....
}
@Override
public void failure(RetrofitError error) {
// ....
}
}
);
private static boolean findBinary(String binaryName) {
boolean found = false;
if (!found) {
String[] places = { "/sbin/", "/system/bin/", "/system/xbin/",
"/data/local/xbin/", "/data/local/bin/",
"/system/sd/xbin/", "/system/bin/failsafe/", "/data/local/" };
for (String where : places) {
if (new File(where + binaryName).exists()) {
found = true;
break;
}
}
}
return found;
}
Note that all the phones do not give access to the same info, like the phone number rarely accessible, but those ones look pretty common.
Hope this can help...

- 2,889
- 1
- 21
- 38
Using Build class you can get all of this information.
to write down those info in a Toast (For Example) you can use:
Toast.makeText(getApplicationContext(), ""+Build.HARDWARE+Build.DEVICE+Build.MANUFACTURER+ "etc..", Toast.LENGTH_SHORT).show();
for more info about the build class check out the link above.
hope this will help.

- 3,678
- 2
- 21
- 56
You can read /proc/meminfo
and /proc/cpuinfo
for example.
These do not require root access and contain information about the memory / cpu.
Details on how to read these can be found here: Any way to run shell commands on android programmatically?

- 1
- 1

- 2,695
- 18
- 30