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
anL
New Contributor
Posts: 7
Registered: ‎06-09-2013
My Device: 9800
My Carrier: MTN

Null values on reading custom JAD attributes

Hello,

 

I have read many articles on the internet and blackberry suppor forums but cannot solve my problem.

 

I have a blackberry Application. It is downloaded from a web page which provides dynamic JAD file content. The JSP prints those :

 

out.println("Appid: "+ appid);
out.println("Ip: "+ user.getIp());
out.println("Servicename: "+ service);
out.println("MIDlet-Version: 1.0.0");
out.println("MIDlet-Jar-URL: MyApp.jar");
out.println("MIDlet-Jar-Size: 91633");
out.println("MicroEdition-Profile: MIDP-2.0");
(and other attributes goes on like that..)

 

 

I need to get my custom attributes like "Appid" but it sometimes gets null values. User can download and run the app, but some of them cannot get my custom attributes. I dont know it is about the phone model or the current state of OS, but according to my logs, this problem appears mostly on those devices :

9800 with OS 6.0.0.546

9300 with OS 6.0.0.570

9300 with OS 6.0.0.668

9320 with OS 7.1.0.398

 

My code to get attributes :

 

CodeModuleGroup cmg =null;
CodeModuleGroup[] allGroups =CodeModuleGroupManager.loadAll();
String moduleName =ApplicationDescriptor.currentApplicationDescriptor().getModuleName();

for(int i =0; i < allGroups.length; i++){if(allGroups[i].containsModule(moduleName)){

cmg = allGroups[i];break;}}if(cmg !=null){
AppData.firstPageURL = cmg.getProperty("Firstpage");
AppData.appId = cmg.getProperty("Appid");
AppData.firstIp = cmg.getProperty("Ip");
AppData.firstSubServiceName = cmg.getProperty("Servicename");

for(Enumeration e = cmg.getPropertyNames(); e.hasMoreElements()Smiley Wink{
String name =(String) e.nextElement();
String value = cmg.getProperty(name);
AppData.errorStep +="-"+ name +":"+ value +"-";
}
}

 

By the way, I determined that the code in the for loop above never runs in these cases.

Any idea ?

New Member
Posts: 12
Registered: ‎06-04-2013
My Device: 9800
My Carrier: BSNL

Re: Null values on reading custom JAD attributes

Same here.

 

Please anyone found solutions.

 

help us.

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Null values on reading custom JAD attributes

are you sure that the app was installed OTA?
if it was installed using desktop manager, javaloader, BES distribution or any non-OTA distribution way there won't be jad attributes to read.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
anL
New Contributor
Posts: 7
Registered: ‎06-09-2013
My Device: 9800
My Carrier: MTN

Re: Null values on reading custom JAD attributes

[ Edited ]

As I said, I have a jsp page and it provides JAD outputs. I install the app by typing the jsp address into the BB browser. Is there an additional thing that I should do to make OTA link ?

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Null values on reading custom JAD attributes

Do you use the User Agent or some other information to tailor the jad file?

 

Have you tried to download the built jad file anywhere to confirm that it does in fact include the attributes you expect?

anL
New Contributor
Posts: 7
Registered: ‎06-09-2013
My Device: 9800
My Carrier: MTN

Re: Null values on reading custom JAD attributes

All I do is to print jad attributes dynamicly with my jsp (in MIME type configured web server).

 

When a user opens my application, it calls another jsp with the expected parameters. Sometimes the parameters are null. So I can understand who can read my custom parameters correctly and who cannot.

 

The generated jad info is below :

 

MIDlet-Name: MyApp
MIDlet-Vendor: MyAppVendor
Appid: 1124203287
Phonetype: 9300
Ip: 11.11.211.11
Servicename: Game
MIDlet-Version: 1.0.0
MIDlet-Jar-URL: MyApp
MIDlet-Jar-Size: 61533
MicroEdition-Profile: MIDP-2.0
MicroEdition-Configuration: CLDC-1.1
MIDlet-1: ,img/icon.png,
RIM-MIDlet-Flags-1: 0
Manifest-Version: 1.0
RIM-COD-URL: MyApp.cod
RIM-COD-Size: 39852
RIM-COD-Creation-Time: 1370714765
RIM-COD-Module-Name: MyApp
RIM-COD-Module-Dependencies: net_rim_cldc,net_rim_bb_browser_field2_api,net_rim_os,net_rim_bbapi_browser,net_rim_networkapi,net_rim_xml,net_rim_xml_org
RIM-COD-SHA1: 2e 00 0e 95 ae 17 8c 73 32 d9 59 a7 a1 5b d9 f6 71 17 eb e2
Firstpage: http://mypage.com

 

Is it possible that the problem is about my attribute names ? Maybe I should give names like "RIM-APP-ID" ?

 

 

anL
New Contributor
Posts: 7
Registered: ‎06-09-2013
My Device: 9800
My Carrier: MTN

Re: Null values on reading custom JAD attributes

I really need help for this problem. Any Idea ?

anL
New Contributor
Posts: 7
Registered: ‎06-09-2013
My Device: 9800
My Carrier: MTN

Re: Null values on reading custom JAD attributes

Then we should report this situation as a bug, right ?

anL
New Contributor
Posts: 7
Registered: ‎06-09-2013
My Device: 9800
My Carrier: MTN

Re: Null values on reading custom JAD attributes

Is there no answer for my problem ?? I dont understand why the name of this board is "support forum". 

Thanks anyway.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Null values on reading custom JAD attributes

Think this is the page that you should go to for official support:

http://uk.blackberry.com/support.html

 

This is a peer to peer forum - but we can only help with the problems we know something about and can recreate - and in this case you are dynamically creating the jad so we are not sure what is happening. 

 

So if you want help, I suggest you create a little test application that replicates your problem with a static jad file.  Then you can publish both and we can check to see if the code matches what we expect. 

 

Then if it really is a bug, this is something you can easily report.

 

OK?