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
Contributor
hendrelouw
Posts: 43
Registered: ‎11-14-2011
My Device: Cure 9300 3G
My Carrier: Vodacom South Africa

ConnectionFactory return a null ConnectionDescrptor on the Curve 9380 Simulator

Hello

 

The application works 100% on the Curve 9300 simulator and physical device, however when I debug the application on the Curve 9380 simulator my ConnectionDescriptor returned from the ConnectionFactory is null.

 

When I turn my Mobile Network off and on again using Manage Connection on the Home Screen, a non null ConnectionDescriptor is returned and the application functions correctly.

 

Why do I get a null descriptor before I turn the connection off and on?

 

My environment:

 

BlackBerry Smartphone Simulator 4.1.0.33

Curve 9380

JDE 5.0

 

The code:

 

I first declare an Integer array of transports.

 

private int[] transports =
{
        TransportInfo.TRANSPORT_TCP_CELLULAR ,
        TransportInfo.TRANSPORT_TCP_WIFI ,
        TransportInfo.TRANSPORT_BIS_B ,
        TransportInfo.TRANSPORT_MDS
};

Then I create a ConnectionFactory, removing transports that do not have coverage or is not available.

 

    private void createConnectionFactory ()
    {
        connectionFactory = new ConnectionFactory();
        connectionFactory.setConnectionAttemptListener( this );

        /*
         * Remove transports that are not currently available or are currently out of coverage.
         */
        for ( int i = 0; I < transports.length; i++ )
            if ( !TransportInfo.isTransportTypeAvailable( transports[ i ] ) || !TransportInfo.hasSufficientCoverage( transports[ i ] ) ) Arrays.removeAt( transports, i );

        /*
         * Remove TRANSPORT_TCP_WIFI from list.
         */
        for ( int i = 0; i < transports.length; i++ )
            if ( transports[ i ] == TransportInfo.TRANSPORT_TCP_WIFI ) Arrays.removeAt( transports, i );

        /*
         * Indicates the transports that can be used to create a connection as well as the order in
         * which the transports a tried.
         */
        connectionFactory.setPreferredTransportTypes( transports );
    }

 Finally, I call the connectionFactory's getConnection method.

 

            descriptor = connectionFactory.getConnection( request.getRequestUrl() );

 

 

 

Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: ConnectionFactory return a null ConnectionDescrptor on the Curve 9380 Simulator

maybe because you include bis_b but do not set the appropriate connection string.
see
http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/io/transport/options/BisBOptio...
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
pradeep_ch
Posts: 543
Registered: ‎12-23-2010
My Device: Z10
My Carrier: Airtel

Re: ConnectionFactory return a null ConnectionDescrptor on the Curve 9380 Simulator

Yea,

 

We are also face same problems in simulators like 9860,9900...etc.

But with real devices we never face these problems.

 

I think the problem with simulators only.

 

Thanks.

 

 

 

Please use plain text.
Contributor
hendrelouw
Posts: 43
Registered: ‎11-14-2011
My Device: Cure 9300 3G
My Carrier: Vodacom South Africa

Re: ConnectionFactory return a null ConnectionDescrptor on the Curve 9380 Simulator

My issue is on the device as well as the simulator. Specifically the Curve 9380.

 

Please use plain text.
Contributor
hendrelouw
Posts: 43
Registered: ‎11-14-2011
My Device: Cure 9300 3G
My Carrier: Vodacom South Africa

Re: ConnectionFactory return a null ConnectionDescrptor on the Curve 9380 Simulator

Simon, thank you for the response. What are to possible settings for the bis_b connectionType referred to by the link you posted?
Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: ConnectionFactory return a null ConnectionDescrptor on the Curve 9380 Simulator

you need a connection suffix that you can obtain by registering for BIS or for BIS-push.
It is not allowed to write it on the forum (but it can be found by other means, of course).
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.