Get Signal Strength in Android

Define Variables: TelephonyManager mTelephonyManager; MyPhoneStateListener mPhoneStatelistener; int mSignalStrength = 0; Then add this class to your code: class MyPhoneStateListener extends PhoneStateListener { @Override public void onSignalStrengthsChanged(SignalStrength signalStrength) { super.onSignalStrengthsChanged(signalStrength); mSignalStrength = signalStrength.getGsmSignalStrength(); mSignalStrength = (2 * mSignalStrength) – 113; // -> dBm } } and in your onCreate method use: mPhoneStatelistener = new MyPhoneStateListener(); mTelephonyManager … Read more

How to get phone number from an incoming call?

Make a Broadcast receiver say ServiceReceiver assign its action in Manifest. <receiver android:name=”.ServiceReceiver” > <intent-filter> <action android:name=”android.intent.action.PHONE_STATE” /> </intent-filter> </receiver> Add a PhoneStateListener to your TelephonyManager, PhoneStateListener having override onCallStateChanged() with Incoming number parameter. Thats it. ServiceReceiver.Java public class ServiceReceiver extends BroadcastReceiver { @Override public void onReceive(final Context context, Intent intent) { TelephonyManager telephony = … Read more

Make a phone call programmatically

To go back to original app you can use telprompt:// instead of tel:// – The tell prompt will prompt the user first, but when the call is finished it will go back to your app: NSString *phoneNumber = [@”telprompt://” stringByAppendingString:mymobileNO.titleLabel.text]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];

What regular expression will match valid international phone numbers?

\+(9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d| 2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]| 4[987654310]|3[9643210]|2[70]|7|1)\d{1,14}$ Is the correct format for matching a generic international phone number. I replaced the US land line centric international access code 011 with the standard international access code identifier of ‘+’, making it mandatory. I also changed the minimum for the national number to at least one digit. Note that if you … Read more

How to grant MODIFY_PHONE_STATE permission for apps ran on Gingerbread

The problem you’re having was introduced in Android 2.3 (Gingerbread). Any code you have that requires MODIFY_PHONE_STATE will work all the way up to (and including) Android 2.2, but will break for Android 2.3+. A change was checked in by David Brown that limits the use of the MODIFY_PHONE_STATE permission to system apps. System apps … Read more