本文介绍了如何检测可用的APN设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要在我的黑莓应用程序以某种方式访问​​APN设置。我的应用程序是在JDE 4.2.1运行。任何帮助吗?

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

推荐答案

有一个名为 ServiceRecord 类,可以照顾这个要求。这里是一个简短的片段。

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();

UID CID 取决于你试图使用(即WAP,WiFi或一些什么样的服务其他)。您可以通过以下检索所有ServiceRecord对象的完整列表。

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();

您可以使用此code找出你需要的记录以及它相应的 UID CID

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

请注意,这是您只访问过,如果你有一个签名的应用程序的类别之一。这里的链接到的Javadoc ServiceRecord

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的JavaDoc

这篇关于如何检测可用的APN设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 05:51