Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Trusted Contributor
Posts: 224
Registered: ‎08-11-2010
My Device: Not Specified
Accepted Solution

Invoking WAP browser on OS 7 (via BrowserSessionFactory)

Our code is based on the following article "Invoke the browser"

http://supportforums.blackberry.com/t5/Java-Development/Invoke-the-browser/ta-p/445362

On OS7 device BrowserSessionFactory cannot the WAP browser - the reason is that the following code:

if( myRecord.isValid() &&
    !myRecord.isDisabled() &&
    (myRecordHelper.getConfigType() ==
    ServiceRecordHelper.SERVICE_RECORD_CONFIG_TYPE_WAP2)
    && (myRecordHelper.getNavigationType() != -1))
{
    uid = myRecord.getUid();
    break;
}

 
is not triggered because myRecordHelper.getNavigationType() returns -1.

Below are the properties of the WAP2 record in the Service Book

myRecord: WAP BrowserConfig[WAP BrowserConfig]
myRecord.getUid: WAP BrowserConfig
myRecord.isValid: true
myRecord.isDisabled: false
myRecord.getNavigationType: -1

 
If we remove the "!= -1" check, the factory can detect and open the WAP browser
(but this change probably has some other side effects)

Can somebody from RIM please review this issue and let us know what is the correct
way to open WAP Browser on OS 7 device ?

BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Invoking WAP browser on OS 7 (via BrowserSessionFactory)

Invoking the browser without specifying a transport type should work for most cases.  The browser now auto detects the appropriate transport route to use.  Why do you need to invoke the WAP browser specifically?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Trusted Contributor
Posts: 224
Registered: ‎08-11-2010
My Device: Not Specified

Re: Invoking WAP browser on OS 7 (via BrowserSessionFactory)

hi MSohm,

> Why do you need to invoke the WAP browser specifically?

To prevent frauds, many ad networks monitor if the following IP addresses are identical:
* IP address from which "ad HTML was loaded"
* IP address from which "user click is sent" (i.e. the IP address from which browser session was opened.

i.e. if ad HTML ws loaded via WAP connection, we need to open "WAP Browser"; if ad HTML was loaded via BIS connection we need to open "BIS Browser".

Of course we want to be relatively sure that the desired browser can display the requested page.

We are reviewing BrowserSessionFactory example, it seems to be somewhat outdated (we have found some other issues during the weekend).

Hopefully we can work with you to update it and make it compatible
BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Invoking WAP browser on OS 7 (via BrowserSessionFactory)

There was a bug in that sample.  This line:

 

&& (myRecordHelper.getNavigationType() != -1))

 

Should actually be:

 

(myRecordHelper.getNavigationType() <= 0))

 

Make those changes (that line exists twice in the sample) and it should pick up the appropriate service records.

 

I'll fix this in the article.

 

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Trusted Contributor
Posts: 224
Registered: ‎08-11-2010
My Device: Not Specified

Re: Invoking WAP browser on OS 7 (via BrowserSessionFactory)

Thanks MSohm !

 

We will continue testing with this change, I wil post an update later today.

Highlighted
Trusted Contributor
Posts: 224
Registered: ‎08-11-2010
My Device: Not Specified

Re: Invoking WAP browser on OS 7 (via BrowserSessionFactory)

 

hi Mark,

Here is the next issue, we'd like to get your feedback again.

Test environment: OS5, OS6, OS7.

Scenario: WiFi is On and connected, Mobile Network is Off (but device has SIM card and is connected to BIS).

Problem: ServiceRecord.isDisabled() returns false, thus BrowserSessionFactory does not return any transport-specific sessions.

It seems that isDisabled returns true only if there is a route to BIS server available via mobile network.


 Our tests show that if we remove the isDisabled() check and replace it with TransportInfo / CoverageInfo coverage check, the code works in all scenarious.

Below is our workaround - can you please review it and let us know if there are any problems with it ?

 

Thanks again !


public static BrowserSession createBISBrowserSession()
{
  // If there are browser services found - search for the
  // Service Record for the given browserType
  String uid = null;
  int numRecords = records.length;

  for( int i = 0; i < numRecords; i++ )
  {
      ServiceRecord myRecord = records[i];
      ServiceRecordHelper myRecordHelper = new ServiceRecordHelper(myRecord);

      if( myRecord.isValid() &&
          myRecordHelper.getConfigType() == ServiceRecordHelper.SERVICE_RECORD_CONFIG_TYPE_BIS
        )
      {
        boolean isDisabled = myRecord.isDisabled();

        if (isDisabled)
        {
          if (TransportInfo.hasSufficientCoverage(TransportInfo.TRANSPORT_BIS_B))
          {
           // WiFi record returns isDisabled, but TransportInfo reports Sufficient Coverage for TRANSPORT_BIS_B - assume it's ok
            isDisabled = false;
          }
        }

        if (!isDisabled)
        {
          uid = myRecord.getUid();
          break;
        }
      }
  }
  BrowserSession res = null == uid ? null : Browser.getSession(uid);
  return res;
}


public static BrowserSession createWiFiBrowserSession()
{
  String uid = null;

  // no WiFi coverage ?
  if (WLANInfo.getWLANState() != WLANInfo.WLAN_STATE_CONNECTED) return null;

  int numRecords = records.length;

  for( int i = 0; i < numRecords; i++ )
  {
    ServiceRecord myRecord = records[i];
    ServiceRecordHelper myRecordHelper = new ServiceRecordHelper(myRecord);

    if( myRecord.isValid() &&
        myRecordHelper.getConfigType() ==ServiceRecordHelper.SERVICE_RECORD_CONFIG_TYPE_WIFI )
    {
      boolean isDisabled = myRecord.isDisabled();

      if (isDisabled)
      {
        if (
            TransportInfo.hasSufficientCoverage(TransportInfo.TRANSPORT_TCP_WIFI)
        )
        {
           // WiFi record returns isDisabled, but TransportInfo reports Sufficient Coverage for TRANSPORT_TCP_WIFI - assume it's ok
          isDisabled = false;
        }

        if (
            CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_DIRECT, RadioInfo.WAF_WLAN, false)
        )
        {
           // WiFi record returns isDisabled, but CoverageInfo reports Sufficient Coverage for direct connections over WIFI - assume it's ok
          isDisabled = false;
        }
      }

      if (!isDisabled)
      {
        uid = myRecord.getUid();
        break;
      }
    }
  }

  BrowserSession res = null == uid ? null : Browser.getSession(uid);
  return res;
}

 

 

BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Invoking WAP browser on OS 7 (via BrowserSessionFactory)

Nice work!  I don't see any issue with the code you've posted.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Trusted Contributor
Posts: 224
Registered: ‎08-11-2010
My Device: Not Specified

Re: Invoking WAP browser on OS 7 (via BrowserSessionFactory)

Thanks Mark !

 

We cannot test BES browser right now, I assume that we can perform a similar check as the one done for TransportInfo.TRANSPORT_BIS_B ?  

 

Also we have two different workarounds when WiFi record returns isDisabled - is there difference between them ? Can we keep just one of them (and which one ?)

BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Invoking WAP browser on OS 7 (via BrowserSessionFactory)

Yes, you can perform a similar test for BES transports.  FYI you can download a free trial BES here:  http://us.blackberry.com/apps-software/server/offers/v50_trial.jsp

 

The two WiFi checks should be equivalent.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Trusted Contributor
Posts: 224
Registered: ‎08-11-2010
My Device: Not Specified

Re: Invoking WAP browser on OS 7 (via BrowserSessionFactory)

Thanks Mark ! 

 

I will close this thread, will create a new thread if we observe different problems / need additional info in future.

 

Would you me to send you the updated code ? Just sent me a private message with instructions on how to contact you.