BlackBerry Java程序开发如何设置User Agent

BlackBerry Java程序开发,User Agent是需要手工设置,这样更灵活。

首先使用System.getProperty("browser.useragent")获得User Agent数据如下:

例如:"Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; en) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.0.0.246 Mobile Safari/534.1+"

 

然后用HttpConnection. setRequestProperty()设置User Agent属性。

例如:HttpConnection.setRequestProperty("User-Agent",     "Profile/MIDP-2.0 Configuration/CLDC-1.0");

 

参考:How To - Retrieve information about the BlackBerry Browser

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800878/800733/How_To_-_Retrieve_information_about_the_BlackBerry_Browser.html?nodeid=1033750&vernum=0

 

 

How to detect the BlackBerry Browser

http://supportforums.blackberry.com/t5/Web-Development/How-to-detect-the-BlackBerry-Browser/ta-p/559862?IID=DEVSF30

你可能感兴趣的:(java,user,mobile,BlackBerry,程序开发)