Created
June 16, 2010 17:38
-
-
Save reflog/441007 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static synchronized String getAppVersion() { | |
ApplicationDescriptor descriptor = ApplicationDescriptor.currentApplicationDescriptor(); | |
String version = descriptor.getVersion(); //read from the alx files | |
if(version == null || version.trim().equals("")) { //read value from jad file | |
CodeModuleGroup[] allGroups = CodeModuleGroupManager.loadAll(); | |
String moduleName = ApplicationDescriptor.currentApplicationDescriptor().getModuleName(); | |
if (moduleName == null || allGroups == null) { | |
return "1.0 (sim)"; // be default, for simulator | |
} | |
for (int i = 0; i < allGroups.length; i++) { | |
if (allGroups[i] != null && allGroups[i].containsModule(moduleName)) { | |
version = allGroups[i].getProperty("MIDlet-Version"); | |
if(version != null) | |
return version; | |
} | |
} | |
return "1.0 (dev)"; | |
} | |
return version; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment