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
SmartPhoneDev
Posts: 13
Registered: ‎08-26-2010
My Device: Not Specified

Roaming status not shown properly

Hi,

 

I am using RadioInfo API to find the roaming status of the device.

 

The code snippet,

 

String roamingStatus = "";

 

if(RadioInfo.getNetworkService() == RadioInfo.NETWORK_SERVICE_ROAMING)

      roamingStatus = "Roaming";

else

      roamingStatus = "Home Netwok";

 

But, I am getting the roamingstatus as Home Network when the device is in roaming.

 

Did I mistake anything in my code?

 

How could I find the roaming status?

 

Please help me!!

 

Thanks,

SmartPhoneMate

 

 

 

Developer
lovish
Posts: 70
Registered: ‎11-24-2009
My Device: Not Specified

Re: Roaming status not shown properly

Try using the flag with bitwise anding

 

 

 final int networkService = RadioInfo.getNetworkService();
        final boolean isRoaming =  
            (0 != (networkServiceState & RadioInfo.NETWORK_SERVICE_ROAMING));
        final boolean isRoamingOffCampus = 
            (0 != (networkServiceState & RadioInfo.NETWORK_SERVICE_ROAMING_OFF_CAMPUS));
        
        return (isRoaming || isRoamingOffCampus);

 

 

Mark kudos if this helps :smileyhappy:

New Contributor
dazzlarpeters
Posts: 3
Registered: ‎03-14-2013
My Device: BBY 9860

Re: Roaming status not shown properly

just a small change to your variable name in the first line is all. :smileyhappy: