advena
advena

Reputation: 83

Java - how to check phone operator by phone number

Is there possibility to find out the operator name by phone number? Of course it's about the mobile phone numbers. Country is easy because of the prefix. But what about the operators?

Upvotes: -1

Views: 2695

Answers (5)

Md. Saifur Rahman
Md. Saifur Rahman

Reputation: 404

this is php code for bd phone numbers


if ( !function_exists( 'getOperator' ) ) {

    function getOperator( $mobile = '' ) {
        $prefix = substr( $mobile, 0, 3 );
        $operator = '';
        // Default value

        switch ( $prefix ) {
            case '018':
            $operator = 'robi';
            break;
            case '017':
            case '013':
            $operator = 'gp';
            break;
            case '016':
            $operator = 'airtel';
            break;
            case '019':
            case '014':
            $operator = 'bl';
            break;
            case '015':
            $operator = 'teletalk';
            break;
            // Add more cases as needed for additional prefixes
            default:
            // Handle unknown prefixes if needed
            break;
        }

        return $operator;
    }

}

Upvotes: 0

Paweł Gawlas
Paweł Gawlas

Reputation: 144

Maybe it's probablity to read information about operator from sim card, on every sim card it's write information about country and operator: http://en.wikipedia.org/wiki/Mobile_country_code but in that case you have to have physical access to sim card. So your app maybe can find the operator of phone that it's runing on, but it's still imposible to find operator with only phone number, unless you have acces to operators databeses of course ;)

Upvotes: 0

M Sach
M Sach

Reputation: 34424

It won't be possible logically. Think of scenario where portability from one operator to another is viable keeping the same number

Upvotes: 0

Izzy
Izzy

Reputation: 6866

For android apps you can look into TelephonyManager

So you can have something like this

TelephonyManager manager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE));
String carrierName = manager.getNetworkOperatorName();

Upvotes: 1

Paweł Gawlas
Paweł Gawlas

Reputation: 144

I don't how it's look like in every country, but in my country ( Poland ) it's imposible because the costumers can change the operator and keep old phone number.

Upvotes: 2

Related Questions