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
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>")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With