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
Posts: 19
Registered: ‎12-26-2010
My Device: 9800

How to Capture MSISDN Number from the device

Dear All,

 

I would like to know if fetching MSISDN number from the SIM card is at all possible.

I have used the following code to get msisdn:-

String phNo = Phone.getDevicePhoneNumber(true);

However, this will only retrieve the number that is manually set under option screen on BB.

 

We need the phone number for verification purpose and carrier billing integration.

 

Quick response will be appreciated. I would also request the Blackberry Forum Experts to answer this query so that this information can be shared with carrier as well.

 

Thanks

Regards

Raheal

Regular Contributor
Posts: 77
Registered: ‎09-19-2008
My Device: Blackberry 8320
My Carrier: Airtel India

Re: How to Capture MSISDN Number from the device

If you are developing application for particualr carrier then I think better solution is to tie up with carriers to send MSISDN in HTTP request header which can be retrived at your server end and process further. This is possible with Indian carriers (I have done with Airtel a few years back for my web application), however you have to check with other region carriers.

 

Normally we use PIN number instead of MSISDN in BB programs.

Regular Contributor
Posts: 77
Registered: ‎01-27-2010
My Device: Dev Alpha
My Carrier: Verizon

Re: How to Capture MSISDN Number from the device

In the past, I check a phone number by write code connecting to server using WAP2. Then a server will check phone number from header of request (anything, I'm not sure Smiley Tongue) and response it back to a client.

 

If you want to check a carrier only. I'm not sure that is it has method available? ,but I can use this below method to check IMSI code of SIM card, This method will check a SIM card that never changed before or not.

 

 

private static boolean wasSimSwap() {
        byte[] storedSim = PersistentStorage.getSimCardInfo();
        byte[] currentSim = null;
        try {
            currentSim = SIMCardInfo.getIMSI();
        } catch( SIMCardException e ) {
        }
        Logger.log( "Comparing SIM card data, current - " + arrayToString( currentSim ) + ", stored - " + arrayToString( storedSim ) );
        if( storedSim == null ) {
            // we didn't store any SIM card info at the registration time
            if( currentSim == null ) {
                // stored and current SIM are both NULL,
                // assume that this is the same user
                return false;
            } else {
                // stored SIM is NULL while current is not NULL
                return true;
            }
        } else {
            if( currentSim == null ) {
                // SIM card was removed
                return true;
            } else {
                // check that the stored card is the current one
                return !Arrays.equals( storedSim, currentSim );
            }
        }
    }
    
    private static String arrayToString( byte[] arr ) {
        if( arr == null ) {
            return "NULL";
        }
        StringBuffer sb = new StringBuffer( "[" );
        for( int i = 0; i < arr.length && i < 4; i++ ) {
            sb.append( arr[ i ] ).append( ',' );
        }
        sb.append( "...]" );
        return sb.toString();
    }

 

 

By arrayToString() method, It'll print an IMSI code string (not sure) and I find a carrier number in this. Smiley Happy 

 

 

Maz

 

New Member
Posts: 2
Registered: ‎05-28-2011
My Device: BlackBerry Curve 8520
My Carrier: 2005

Re: How to Capture MSISDN Number from the device

Hi,

 

this is very interesting talk about MSISDN. My friends has a good website about that topic.

You cna check it, if you like.

 

All about MSISDN

 

all the best

[url=http://www.msisdn.org]MSISDN[/url]