import net.rim.device.api.system.*;
import net.rim.device.api.servicebook.*;
public class ServiceBookExample extends Application {
ServiceRecord[] _sRecordsArray; // Creates a ServiceRecord array.
ServiceBook _servicebook; // Creates a ServiceBook variable.
String cidValue, sbName, sbAPN;
public static void main(String[] args) {
// Create a new instance of the application and
// start the event thread.
ServiceBookExample app = new ServiceBookExample();
app.enterEventDispatcher();
}
public ServiceBookExample() {
// Returns a reference to the service book from the factory.
_servicebook = ServiceBook.getSB();
// Returns an array of all registered service records.
_sRecordsArray = _servicebook.getRecords();
// Loops through the service record array
// and obtains specific information relating
// to each item and prints it to the debugging output.
for (int i = 0; i < _sRecordsArray.length; i++) {
// Obtains the Service Book CID
cidValue = _sRecordsArray[i].getCid();
// Obtains the Name of the Service Book
sbName = _sRecordsArray[i].getName();
if (cidValue.equals("BrowserConfig")
&& sbName.startsWith("WAP Browser")) {
// Obtains the Service Book's APN
// (Associated Access Point Name)
String sbAPN = _sRecordsArray[i].getAPN();
}
}
}
}
Friday, July 31, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment