问题
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