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
New Developer
Posts: 48
Registered: ‎09-26-2008
My Device: Not Specified

Code not working on device...

Hi ,

this is the code that i m using to get wap apn and gatway for the my application but but when i m using this on device still getting problem as tunnel not found i know it means thatmy applcaition is not getng apn adn wapgateway but in my mobile i m having airtel can and i have also check servicebook where i m getting thsi wap services book there .

 

please can any one tell me what is the problem.i m run my applcaition on curve devices..

 

 

 

String URL= url; StringBuffer URLString = new StringBuffer(); URLString.append(URL); System.out.println("url"+URLString.toString()); try{ ServiceBook serviceBook = ServiceBook.getSB(); ServiceRecord[] records =serviceBook.findRecordsByCid("WAP"); System.out.println("records"+serviceBook.findRecordsByCid("WAP")); System.out.println("records length"+records.length); for(int i = 0; i < records.length; i++){ if(records[i].getName().equalsIgnoreCase("WAP Transport")){ URLString.append("?WAPGatewayIP="); String networkAddress =records[i].getNetworkAddress(); URLString.append(networkAddress.substring(0,networkAddress.indexOf(':'))); URLString.append("&WAPGatewayAPN="); URLString.append(records[i].getAPN()); URL = URLString.toString(); System.out.println("url"+URLString.toString()); } } System.out.println("url"+URL.toString()); }catch(Exception e){ System.out.println("Exception : "+e.toString()); } con = (HttpConnection)Connector.open(URL);

 

 this code is working but internet in my applcaiton is not working by using this code 

 

Regards,

Neev

 

BlackBerry Development Advisor
Posts: 15,696
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Code not working on device...

The recommended approach is to obtain the WAP Gateway information from your carrier and embed it within your application, or have the user enter it.  The information you are trying to read from the service book may not be valid.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 48
Registered: ‎09-26-2008
My Device: Not Specified

Re: Code not working on device...

Thank you sir ,

 

actully the device that i m having is brought from US.and here in india we are having airtel carriers .actully in my device facebook ,google talk ,yahoo mrg .are able to acces internet without setting apn where are my apppliaction that is made by me is not able to acces net without setting apn .i want to right the code such as without setting apn i  can access acces internet .

 

i have seen webpage "what are the different ways of making internet connaction" and video where you people have givien knowlege about how to make internet connection but no luck from that .

 

i have also set deviceside parameter as true .but still i m facing the same problem .please can you let meknow that is it my devices problem because of which i m not able to access internet .and can i have any email address where i can send app make by me to you people so that u can check it that it is working on your devices or not ...my email address is guptanavneet2006@gmail.com

 

please let me know can you people help me 

 

Regrads,

Navneet Gupta.

New Developer
Posts: 31
Registered: ‎09-24-2008
My Device: Not Specified

Re: Code not working on device...

HI neev,

 

 u set the deviceside=true; it means that ur trying to access direct TCP connection.

 

thats why ur application checked TCP and make connection using it.

 

use CoverageInfo class to check which coverage is available on ur device.

and then set deviceside according to ur coverage.

 

may this help u.

 

mobi_magic.

New Developer
Posts: 48
Registered: ‎09-26-2008
My Device: Not Specified

Re: Code not working on device...

Thanks but i m doing this and checking the covrage but still by using deviceside ==true this is working on the devices that have apn setting set but not on the devices that have apn as blank but they have internet on there device.
BlackBerry Development Advisor
Posts: 15,696
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Code not working on device...

Specifying deviceside=true forces the application to connect over direct TCP.  This requires a user to have entered the APN settings under Options, (Advanced Options), TCP or your application to provide them in the connection URL.

 

How To - Specify APN information for a direct TCP connection 
Article Number: DB-00532

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/How_To_...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker