Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there any way to set APN programmatically in blackberry?

We can get APN Name in Blackberry but can i know is there any way to set APN in an application. Kindly help me out on this?

Thanks in Advance

like image 698
Aman Arora BB Avatar asked Sep 17 '12 06:09

Aman Arora BB


1 Answers

Sure you can. But I think you know that apn is option for direct connection only. And I think you know that it doesn't work on many carriers. So it's preferable to use wifi, bis-b, wap2. But maybe your are targeting on specific carrier.

Preferable if target is 5.0+:

ConnectionFactory connectionFactory = new ConnectionFactory();
connectionFactory.setPreferedTransportTypes(new int[] {..., TransportInfo.TRANSPORT_TCP_CELLULAR,...});
TcpCellularOptions transportOptions = new TcpCellularOptions();
transportOptions.setApn("<your apn>");
transportOptions.setTunnelAuthUsername("<username if required>");
transportOptions.setTunnelAuthPassword("<password if required>");
connectionFactory.setTransportTypeOptions(TransportInfo.TRANSPORT_TCP_CELLULAR, transportOptions);

Rudimental if target is below 5.0 OS:

connection = (<corresponded connection class type>)Connector.open("<your connection prefix>" + ";deviceside=false;apn=<your apn name>;TunnelAuthUsername=<username if required>;TunnelAuthPassword=<password if required>")
like image 167
Eugen Martynov Avatar answered Nov 05 '22 12:11

Eugen Martynov