Android: how to detect a private number programmatically
Posted
by
Bao Le
on Stack Overflow
See other posts from Stack Overflow
or by Bao Le
Published on 2011-01-10T18:50:40Z
Indexed on
2011/01/10
18:53 UTC
Read the original article
Hit count: 276
I use BroadcastReceiver to intercept incoming call on Android phone as below
tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
Bundle bundle = intent.getExtras();
String number = bundle.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
In the "private number" case, I tested on two devices, it shows the number as -1 on HTC Wildfire and -2 on Galaxy S. I checked the android.telephony.PhoneNumberUtils but it could't help me.
Is there a function or a generic way to detect a private number on Android phone? Thanks
© Stack Overflow or respective owner