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
Regular Contributor
Posts: 68
Registered: ‎03-17-2010
My Device: 9000,9500,8900
My Carrier: Airtel,Vodafone
Accepted Solution

Strange Behaviour of my application

Hi

 

I use Storm 2 with Verizon 3g enabled.

 

when I use my application with wi-fi it runs OK but when I use it with data plan It does not run properly.

It does not give me any data which comes from web service. and map is not shown properly.

 

So i prepared a debug release to know which post URL is generated.

 

Here the record is service book record

 

When i debuged the application it gives me the following result

 

Is the current record valid?: true
Is it Disabled: false

Data is valid and is enabled

UID at record0: MMS 50009
Is the current record valid?: true
Is it Disabled: true

Final User Id:null

 

Is there any way to run the app properly on data plan also?

 

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

Re: Strange Behaviour of my application

A bit more information would be useful, saying something "It does not run properly" is a bit like taking you car into a garage and telling them it does not run properly - do you mean the brakes, the starting, the idle speed........

 

The URL you are trying to use, with the connection string and whether you are trying for WAP, or direct TCP would be useful to know too.

 

I believe that Verizon is one of the carriers that automatically puts things through their WAP Gateway, and their WAP Gateway has a transcoder that tries to optimize the data flow so it can screw things up too. 

Regular Contributor
Posts: 68
Registered: ‎03-17-2010
My Device: 9000,9500,8900
My Carrier: Airtel,Vodafone

Re: Strange Behaviour of my application

Hi peter,

Let me explain  you.

 

1.We have a custom list field that gets data from the web service. And according to connection type we append post url parameter for it.

 

2.The custom list field generated properly in wi-fi

 

3.We have checked that if wi-fi can be connected than the app should not execute the block where data plan connection is checked

 

3. there is a splash screen that checks the connection availability and if at any point the connection is lost the application exits.(that means atleast we get connection)

 

4.The thread that fills the list field runs in the background of splash screen

 

5.and when i run this app in Storm 2 with verizon 3g the list is found empty.and as this list is the main part of my application the whole application generates the array of bugs

 

Does that mean that the plan in Verizon device is not confifured properly?

 

Coz this application runned in Storm,Bold and curve all having vodaphone as their service provider.

 

I think i'm clear this time

Thanks in advance

 

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

Re: Strange Behaviour of my application

Can you confirm what connection string you are adding to the URL?

 

Can you confirm that the request is actually getting to the Server?

 

Assuming the request is getting to the Server, is to possible for you to dump out the the actual data that you get back.  Here I'm not talking about the data you get back to your application, but the actual data you get back from Verizon.

 

I suspect your request is either not getting to your Server of the data is being screwed up on the way back.

Regular Contributor
Posts: 68
Registered: ‎03-17-2010
My Device: 9000,9500,8900
My Carrier: Airtel,Vodafone

Re: Strange Behaviour of my application

 


peter_strange wrote:

Can you confirm what connection string you are adding to the URL?


I get NULL as post string as the service book record is said disable. Please see the post. I have put the code and detailed o/p there

 

http://supportforums.blackberry.com/t5/Java-Development/When-records-i-isDisabled-returns-true/m-p/4...

 

 


 Can you confirm that the request is actually getting to the Server?

 

Assuming the request is getting to the Server, is to possible for you to dump out the the actual data that you get back.  Here I'm not talking about the data you get back to your application, but the actual data you get back from Verizon.

 

I suspect your request is either not getting to your Server of the data is being screwed up on the way back.


I think if the problem is server than this application should not run properly in Storm with vodaphone because AFAIK Storm does not have wi-fi available. But it runs as expected.

(Here i may be wrong)

 

Assuming the verizon screws up data than is there any solution?

 

 

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

Re: Strange Behaviour of my application

I believe there is a 'bug in the code you have referenced, in that it will pick up WiFi ServiceRecords as well as WAP 2 Service records.  This will cause you problems on the Storm 2, which supports WiFi but won't on the Storm 1, which does not.  I will update that Thread to indicate this. 

 

I would download the network Diagnostic tool and review how it checks the Service books (which I think it does). 

Here is a post that I think has a more accurate check too:

http://supportforums.blackberry.com/t5/Java-Development/HTTP-via-WAP-2-0-amp-ServiceBook-does-not-se...

Alternatively, and probably more accurately, I believe you can use the CoverageInfo class to determine what networks are currently available, and choose your connection String.

 

But in this case you seem to be saying that you do not add a connection string, because the code you are trying to use to set the connection string returns null.  This 'null' may or may not be correct, I don't think it is correct. 

 

But in fact for a Verizon device, this is probably not a concern, because I believe that a Verizon Storm 2 will try to use WAP 2 if you don't specify anything anyway.  Have a look at the Event log record created at about the time you attempt the connection.  These may tell you.  They would certainly be interesting to review. 

 

"I think if the problem is server than this application should not run properly in Storm with vodaphone because AFAIK Storm does not have wi-fi available"

 

You are potentially incorrect given what I have just said.  More importantly, the fact that something runs in one carrier is no guarantee that it will work using the same connection method in another carrier.  Finally and most importantly, I did not say there was a problem with the Server, I said there was potentially a problem getting to the Server.

 

So can you do what I asked in my previous post?.

a) Can you confirm that the request is actually getting to the Server?

 b) Assuming the request is getting to the Server, is to possible for you to dump out the the actual data that you get back.  Here I'm not talking about the data you get back to your application, but the actual data you get back from Verizon.

 

"Assuming the Verizon screws up data than is there any solution?"

 

I can't answer for Verizon, but in the case of Vodafone UK, which has screwed up some of my data, the answer is yes.  Others can answer for Verizon.  Alternatively, you could try another connection method (e.g. direct TCP). 

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

Re: Strange Behaviour of my application

Just been reminded of this KB article that has code for finding the WAP 2 Connection id:

What Is - Different ways to make an HTTP or socket connection
Article Number: DB-00396
http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is...

Regular Contributor
Posts: 68
Registered: ‎03-17-2010
My Device: 9000,9500,8900
My Carrier: Airtel,Vodafone

Re: Strange Behaviour of my application

Hi Peter,

 

First I want to clarify that It was Just a Snippet fo the code that I think generate the error

 

Here Is Complete Code

 

public static void getUID() {

ServiceBook sb = ServiceBook.getSB();
net.rim.device.api.servicebook.ServiceRecord[] records = sb
.findRecordsByCid("WPTCP");
String uid = null;

for (int i = 0; i < records.length; i++) {
// Search through all service records to find the
// valid non-Wi-Fi and non-MMS
// WAP 2.0 Gateway Service Record.
ConstantData.data += "\nIs the current record valid?: "
+ records[i].isValid() + "\nIs it Disabled: "
+ records[i].isDisabled();
if (records[i].isValid() && !records[i].isDisabled()) {
ConstantData.data += "\n\nData is valid and is enabled";
if (records[i].getUid() != null
&& records[i].getUid().length() != 0) {
ConstantData.data += "\n\nUID at record" + i + ": "
+ records[i].getUid();
if ((records[i].getUid().toLowerCase().indexOf("wifi") == -1)
&& (records[i].getUid().toLowerCase()
.indexOf("mms") == -1)) {
uid = records[i].getUid();
break;
}
}
}
}
ConstantData.data += "\n\nFinal User Id:" + uid;
ConstantData.data += "\n\nUser Id Null?: " + (uid == null);
if (uid != null) {
// open a WAP 2 connection
ConstantData.PostURL = ";ConnectionUID=" + uid;// } else {
// Consider another transport or alternative action.
ConstantData.PostURL = ";interface=wifi";
}
data += "\n\npost Url will be" + ConstantData.PostURL;

}

 

 

Now the thing is that records[i].isDisabled() is true and I think the culprit lies here.

 

Though As you have said

a) Can you confirm that the request is actually getting to the Server?

I am unclear how can i do that. By just fetch the URL and check it in my firefox? or in BB browser? or both ?

 

Please tell me because I'm quite confused here.

 

and other point

 b) Assuming the request is getting to the Server, is to possible for you to dump out the the actual data that you get back.  Here I'm not talking about the data you get back to your application, but the actual data you get back from Verizon.

 

How can i get data from Verizon before it goes in my app? Because in my app i found NULL as list field data.

 

And another question

do whitespace matter when we get the post url? means mostly i get WAP2Trans as post URL in my bb 9000 when on data plan only but once I get WAP2 Trans and the list again was null. So does it expect WAP2Trans only? not any whitespace?

 

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

Re: Strange Behaviour of my application

"Now the thing is that records[i].isDisabled() is true and I think the culprit lies here."

 

I've not checked this code but I wonder if your code is not correct because you are checking the isDisabled for a WiFi ServiceBook and assuming it applies to WAP.  I would desk check your code or debug it on the device. 

 

Re my questions:

 

"a) Can you confirm that the request is actually getting to the Server?"

Your Server presumably has some logging that will tell if a request has reached it.

 

"b) Assuming the request is getting to the Server, is to possible for you to dump out the the actual data that you get back.  Here I'm not talking about the data you get back to your application, but the actual data you get back from Verizon."

I'm not sure what mechanism you are using to send the data, I presume something like kSoap, since you have talked about a Web Service.  Or is it an httpConnection?  You need to look at the response you get in there. 

 

I can't talk about Verizon, but Vodafone have a web page that you must agree to, before you can use the WAP connection.  They put this in there because they assume everyone is going to do browsing.  You are not.  So you might get back a web page that is basically telling you to agree to a connection.  You need to be able to figure out if something like this is happening to you.  If your current code won't let you do it, then you are going to have include some extra debugging stuff in it which does.

 

Finally: "do whitespace matter when we get the post url? means"

The connection string, which includes the WAP2 Trans, is never sent, it is an instruction to the BlackBerry to direct the connection along a particular path. 

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Strange Behaviour of my application

WAP2 does not work on Verizon in the USA.

 

You do not need any APN info with this carrier - you should be able to establish a direct TCP connection.