nixau
nixau

Reputation: 1095

How to detect available APN settings?

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

Upvotes: 0

Views: 2809

Answers (1)

Fostah
Fostah

Reputation: 11776

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

Upvotes: 4

Related Questions