How to detect available APN settings?

最后都变了- 提交于 2019-12-11 16:45:17

问题


I need to access somehow APN settings in my BlackBerry application. My app is running on JDE 4.2.1. Any help?


回答1:


There's a class called ServiceRecord that can take care of this for you. Here's a short snippet.

ServiceRecord record = ServiceBook.getSB().getRecordByUidAndCid(uid, cid);
String apn = record.getAPN();

The uid and cid are dependent on what service you are trying to use (i.e wap, wifi or something else). You can retrieve a complete list of all the ServiceRecord objects by using the following.

ServiceRecord[] records = ServiceBook.getSB().getRecords();
String uid = records[0].getUid();
String cid = records[0].getCid();

You can use this code to figure out which record you need and what its corresponding uid and cid are.

Note that this is one of those classes that you only have accessed to if you have a signed application. Here's the link to the javadocs for ServiceRecord.

ServiceRecord JavaDocs



来源:https://stackoverflow.com/questions/1443946/how-to-detect-available-apn-settings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!