Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 17
Registered: ‎03-03-2009
My Device: Not Specified
Accepted Solution

The best way to find an installed app's module name?

If you don't know an application's module name, how can you find it out?

 

For example, if I have the name of another application's jad file, can I assume that the module name of the app is the jad's basename?  As in, would a jad name of MyApp.jad translate into a module name of "MyApp"?

 

That was my assumption at first, and it is seeming to be the case most of the time, but not all.  In particular, if the jad is name:

MyApp-1.0.0.jad

 

I have found that the actual module name on one Bold running v4.6.167 (and the 4.6.0 JDE simulator of the Bold) is

 MyApp$2d1

 

However, *on another Bold* (this one running v4.6.0.162) , the exact same application shows a module name of

 MyApp$2d1$2e0$2e0

 

So that's why I am wondering if there is some more definitive way to obtain an application's module.  I have scoured the API documentation and the solution is not leaping out at me.

 

Thoughts?

 

Thanks for any help.

 

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: The best way to find an installed app's module name?

[ Edited ]

2D and 2E are hexadecimal representation of ASCII symbols - and .

 

When you install an application that has such symbols device converts it to $xx representation.

 

I do not think that there is a good documentation on this topic.

 

I would do the following.

 

The first approach:

 

Name your application module in unique way, at least give a unique symbolic prefix to the module name.

 

You can use com_yoursite prefix. It nearly 100% that no-one else will use this prefix in his apps.

 

And check this prefix for every module name.

 

The second approach:

 

Process name of every found module to convert $xx to corresponding ASCII symbols and construct user-friendly names.

 

And after that compare these names to find a module you want to be found.

Message Edited by tbilisoft on 30-06-2009 08:02 PM
Developer
Posts: 17
Registered: ‎03-03-2009
My Device: Not Specified

Re: The best way to find an installed app's module name?

Thanks for the reply.

 

I did realize that the dashes and dots were being escaped, and the string I use for a module search has been altered to handle that accordingly. Also, the applications I am searching for are not under my control, so I cannot name them anything more convenient.  

 

My main problem now is handling the inconsistency I mentioned in my first post -- how two different Bold handsets assigned different module names to the identical application (which I found very bizarre -- is that a known issue?).

 

What I am doing now is basically:

 

 

int handles[] = CodeModuleManager.getModuleHandles(); for (int i = 0; i < handles.length; i++) { if (CodeModuleManager.isLibrary(handles[i])) { continue; } String name = CodeModuleManager.getModuleName(handles[i]); if (nameImLookingFor.startsWith(name)) { // Match! System.out.println("match on " + name); nameImLookingFor= name; break; } }

 

 

However, while this piece of code works for the problem I was trying to solve, it occurs to me that I would get into trouble if I were looking for a module "MyAppTest" and someone had installed a module called "MyApp" (because I am using a String.startsWith call instead of an exact string match now).

 

I would love to be able to guarantee some kind of exact matching, but given the differences in the way module names are apparently handled, it doesn't appear that I can.  Am I missing something important here?  Perhaps a further pattern match that I haven't considered?

 

Thanks again.

 

 


 

Developer
Posts: 17
Registered: ‎03-03-2009
My Device: Not Specified

Re: The best way to find an installed app's module name?

Ah.  I can also notice if I've needed to "escape" my module names.  If not, then I can look for an exact match in the list of module names.  If I have, then it appears that I still need to look for something "close enough" and hope for the best.
Highlighted
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: The best way to find an installed app's module name?

Symbols conversion is doing by device software.

 

And seems that different device software versions deal with symbols in different way.

 

Use english letter symbols to name your application or make a unique prefix in name.

 

English letter symbols are not processed neither changed by device software.