Question

I'd like to get access to my currently running applications applicationDescriptor object. I want this so that I can get the current version number and, on the initial screen have a title like "MyApp Version x.x.x" where I get x.x.x from the ApplicationDescriptor.getVersion()

One way that I've found is to use:

ApplicationManager manager = ApplicationManager.getApplicationManager();
ApplicationDescriptor[] descriptors = manager.getVisibleApplications();

//Loop round descriptors then use...
ApplicationDescriptor myApp = manager.getProcessId(descriptors[x]);

Using the loop to check all applications seems a bit long winded to me, i'm hoping that there is an easier route.

Thanks

Was it helpful?

Solution

Got it:

ApplicationDescriptor.currentApplicationDescriptor().getVersion()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top