我们可以在Blackberry中获得APN名称,但我知道有没有办法在应用程序中设置APN。请帮我解决这个问题?
先谢谢
答案 0 :(得分:7)
当然可以。但我想你知道apn只是直接连接的选择。我想你知道它对许多运营商都不起作用。所以最好使用wifi,bis-b,wap2。但也许你的目标是特定的载体。
如果目标是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);
如果目标低于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>")