Question

We are able to get the user agent from device via calling

System.getProperty("browser.useragent")

This method is available for OS 4.7 +

I only tested it on some of the Blackberry simulators: 9530 (os 4.7), 9800 (os 6.0.0)

It works as a charm.

But as far as I know that on real devices, if user changes the blackberry browser, the user agent in the http request to server will be changed. For instance, some of the blackberry devices use Firefox browser.

Therefore I would like to know, if browser setting is changed on the real device, when we call System.getProperty("browser.useragent"), will the return value change???

Has anyone tested on the real device? or does anyone know the anwser.

No correct solution

OTHER TIPS

You could test this out in a Simulator of your choice by creating an App that logs or prints to screen the value of System.getProperty("browser.useragent") then making your noted change in the simulator.

this is an example:

public static String getSystemUserAgent(){
    String agent = "";
    if(System.getProperty("browser.useragent")!=null){
        agent = System.getProperty("browser.useragent");
    }else if(GI.isScreenSmall()){
        agent = "BlackBerry8100/4.5.0.180 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/215";
    }else{
        agent = "BlackBerry8300/4.2.2Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/107UP.Link/6.2.3.15.0";
    }
    return agent;
    }

you can construct the UserAgent with this method

private static String getUserAgent() {
      String userAgent = "Blackberry" + DeviceInfo.getDeviceName() + "/" +
      DeviceInfo.getSoftwareVersion() + " Profile/" + System.getProperty(
         "microedition.profiles" ) + " Configuration/" + System.getProperty(
         "microedition.configuration" ) + " VendorID/" +
         Branding.getVendorId();
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top