1

我正在尝试查找来电电话号码的信息,例如运营商,号码位置,Pincode。请帮助。

4

3 回答 3

0

抱歉,它在 android 中是不可能的。

于 2012-05-18T10:25:43.807 回答
0
<receiver android:name=".CustomBroadcastReceiver">
        <intent-filter>
                <action android:name="android.intent.action.PHONE_STATE" />     
        </intent-filter>
</receiver>

</application>
<uses-sdk android:minSdkVersion="5" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
public class CustomPhoneStateListener extends PhoneStateListener {

private static final String TAG = "CustomPhoneStateListener";

public void onCallStateChange(int state, String incomingNumber){

        Log.v(TAG, "WE ARE INSIDE!!!!!!!!!!!");
        Log.v(TAG, incomingNumber);

        switch(state){
                case TelephonyManager.CALL_STATE_RINGING:
                        Log.d(TAG, "RINGING");
                        break;
        }       
}
public class CustomBroadcastReceiver extends BroadcastReceiver {

private static final String TAG = "CustomBroadcastReceiver";

@Override
public void onReceive(Context context, Intent intent) {
        Log.v(TAG, "WE ARE INSIDE!!!!!!!!!!!");
    TelephonyManager telephony = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
        CustomPhoneStateListener customPhoneListener = new CustomPhoneStateListener();

    telephony.listen(customPhoneListener, PhoneStateListener.LISTEN_CALL_STATE);


    Bundle bundle = intent.getExtras();
    String phoneNr= bundle.getString("incoming_number");
        Log.v(TAG, "phoneNr: "+phoneNr);

}

这可能是你想要的

于 2012-05-18T10:32:41.603 回答
0
TelephonyManager telephonyManager =((TelephonyManager) Context.getSystemService(Context.TELEPHONY_SERVICE));
String operatorName = telephonyManager.getNetworkOperatorName();
similarly the sim operator can be retrieved by using:

String operatorName = telephonyManager.getSimOperatorName();
于 2012-05-18T10:43:35.110 回答