[SOLVED] OS Version, Device Name, and Application Version

Put your problem here if it does not fit any of the other categories.

[SOLVED] OS Version, Device Name, and Application Version

Postby SpaceBoy2000 » Fri Nov 06, 2009 6:21 pm

I would like to obtain the OS Version (1.5, 1.6, 2.0, etc), the device name (anything that can identify the model) and the application version (that is defined in the manifest) programmatically, preferably without any extra scary security notification that scares away more users. I've already been able to get a semi-unique device ID from here, but the other information would be helpful. Any suggestions?
Last edited by SpaceBoy2000 on Fri Nov 06, 2009 10:18 pm, edited 1 time in total.
SpaceBoy2000
Freshman
Freshman
 
Posts: 3
Joined: Sun Nov 01, 2009 7:00 am

Top

Postby SpaceBoy2000 » Fri Nov 06, 2009 10:18 pm

Nevermind, I found the solution. For anyone having the same issue, here's how you get the strings.

OS Version:
Code: Select all
android.os.Build.VERSION.RELEASE
or
Code: Select all
android.os.Build.VERSION.SDK


Device Name:
Code: Select all
android.os.Build.MODEL
or
Code: Select all
android.os.Build.DEVICE


Application Version:
Code: Select all
String version;
try
{
    version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
}
catch (NameNotFoundException e)
{
    version = "Not Found";
}
SpaceBoy2000
Freshman
Freshman
 
Posts: 3
Joined: Sun Nov 01, 2009 7:00 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 13 guests