Five ways to develop online connections using BlackBerry

Source: Internet
Author: User

This article will focus on five methods for developing connections to the Internet using BlackBerry. The BlackBerryJDE API provides five methods for HTTP or socket connections. Please refer to the detailed introduction in this article.

Five ways to develop online connections using BlackBerry

BlackBerryJDE APIs provide five methods for HTTP or socket connection, including:

1. blackberrypoliciseserver (BES) Mode

This method uses BES's BlackBerryMDSServices for network connection. BlackBerryMDSServices is responsible for processing all browser requests or connection requests and Data Encryption. This is the default connection method of blackberry, as follows:

Example 1: (HttpConnection) Connector. open ("http://www.testserver.com ");

The above code automatically uses BlackBerryMDSServices as its default connection path. In actual development, to ensure that the application uses usesBlackBerryMDSServices as its connection path, we need to add the parameter "deviceside = false" at the end of the URL, which is also recommended as follows:

Example 2: (HttpConnection) Connector. open ("http://www.testserver.com; deviceside = false ");

2. BlackBerryInternetServie Mode

This method is a connection interface provided by a third party. It does not encrypt data. You can use HTTPS and SSL for secure connections. Note: currently only open to third-party open partners who have joined BlackBerryAllianceProgram, For details, refer to: http://na.blackberry.com/eng/partners/alliance.jsp

3. DirectTCP

This method allows direct TCP connection on a blackberry that does not use BlackBerryMDS. To enable directTCP, you need to set the APN and the corresponding user name and password in "options-advanced options-TCP/IP" on the mobile phone.

Note 1: Blackberry phones running on the iDEN network include 6510, 7510, 7520, and 7100i. If the deviceside parameter is not specified, for example, 1), the default connection is directTCP; if the deviceside parameter is not specified for other Blackberry phones running on the iDEN network, the default connection is BlackBerryMDS.

NOTE 2: If BlackBerryMDS does not exist during connection, the BlackBerry will automatically adopt the directTCP method.

Therefore, if you want to use directTCP as the default connection method of the BlackBerry phone, we recommend that you add the "deviceside = true" parameter to the URL, as shown below:

Example 3-1 :( SocketConnection) Connector. open ("socket: // testserver: 600; deviceside = true ");

In addition, if your application does not want to use your own APN, you can also specify your own APN in the URL. The following is an example of specifying a direct TCP connection through China Mobile CMNET:

Example 3-2 :( SocketConnection) Connector. open ("socket: // testserver: 600; deviceside = true; APN = cmnet ");

4. Wi-Fi

If you need to create a network connection on Wi-Fi, you do not need to consider the special underlying logic in the application, you can add the parameter "interface = wifi" to the URL to achieve wi-fi connection, as shown below:

Example 4: (StreamConnection) Connector. open ("socket: // testserver: 600; interface = wifi ");

5. WAP

5-1, WAP1.x

Not all mobile operators support connections through the WAP Gateway. To create a WAP connection, the developer must contact the mobile operator, obtain whether such support is provided and their WAP network management parameters.

The following is an example of an HTTP Connection Based on China Mobile cmwap wap Gateway:

Example 5: (HttpConnection) Connector. open ("http://wap.google.com; WAPGatewayIP = 10.0.0.172; WAPGatewayAPN = cmwap ");

Note: The two parameters WAPGatewayIP and WAPGatewayAPN must be specified and are separated by ";". The following lists all WAP parameters, during actual development, determine which parameters need to be set based on the information provided by the carrier.

5-2WAP2.0

If you want to connect to the gateway of WAP2.0, you must specify servicerecord and UID during connection. The following code illustrates how WAP2.0 works during connection:

Example 5:

 
 
  1. ServiceBookServiceBooksb=ServiceBook.getSB();  
  2. ServiceRecord[]records=sb.findRecordsByCid("WPTCP");  
  3. Stringuid=null;  
  4.  
  5. for(inti=0;i<records.length;i++)  
  6. {  
  7. //Searchthroughallservicerecordstofindthe  
  8. //validnon-Wi-Fiandnon-MMS  
  9. //WAP2.0GatewayServiceRecord.  
  10. if(records[i].isValid()&&!records[i].isDisabled())  
  11. {  
  12.  
  13. if(records[i].getUid()!=null&&records[i].getUid().length()!=0)  
  14. {  
  15. if((records[i].getUid().toLowerCase().indexOf("wifi")==-1)&&  
  16. (records[i].getUid().toLowerCase().indexOf("mms")==-1))  
  17. {  
  18. uid=records[i].getUid();  
  19. break;  
  20. }  
  21. }  
  22. }  
  23. }  
  24.  
  25. if(uid!=null)  
  26. {  
  27.  
  28. //openaWAP2connection  
  29. Connector.open(_url+";ConnectionUID="+uid);  
  30. }  
  31. else  
  32. {  
  33. //Consideranothertransportoralternativeaction.  
  34. }  
  35.  

Here, the basic process is to first obtain ServiceRecord from ServiceBook, and then pay attention

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.