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]];

Calling a phone number in swift

Just try: if let url = NSURL(string: “tel://\(busPhone)”) where UIApplication.sharedApplication().canOpenURL(url) { UIApplication.sharedApplication().openURL(url) } assuming that the phone number is in busPhone. NSURL‘s init(string:) returns an Optional, so by using if let we make sure that url is a NSURL (and not a NSURL? as returned by the init). For Swift 3: if let url = … Read more

End call in android programmatically

You do not need to be a system app. First, create package com.android.internal.telephony in your project, and put this in a file called “ITelephony.aidl“: package com.android.internal.telephony; interface ITelephony { boolean endCall(); void answerRingingCall(); void silenceRinger(); } Once you have that, you can use this code to end a call: TelephonyManager telephonyManager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); Class clazz … Read more

iPhone call log / history

Sorry but right now it really can’t be done.. On iOS 5 there isn’t any access to call_history.db -> Which is exactly what you were looking for. The app mentioned here: http://itunes.apple.com/us/app/callog/id327883585?mt=8 Does not work with iOS 5 (don’t download but check the users’ reviews..) On iOS 4, you might still be able to get … Read more

Android dialer application

Create a simple Android application (our dialer). To actually call someone, you just need that method: private void performDial(String numberString) { if (!numberString.equals(“”)) { Uri number = Uri.parse(“tel:” + numberString); Intent dial = new Intent(Intent.ACTION_CALL, number); startActivity(dial); } } Give your application permission to call in AndroidManifest <uses-permission android:name=”android.permission.CALL_PHONE” /> Set in AndroidManifest intention that … Read more

How can incoming calls be answered programmatically in Android 5.0 (Lollipop)?

Update with Android 8.0 Oreo Even though the question was originally asked for Android L support, people still seem to be hitting this question and answer, so it is worth describing the improvements introduced in Android 8.0 Oreo. The backward compatible methods are still described below. What changed? Starting with Android 8.0 Oreo, the PHONE … Read more

How to block calls in android

OMG!!! YES, WE CAN DO THAT!!! I was going to kill myself after severe 24 hours of investigating and discovering… But I’ve found “fresh” solution! // “cheat” with Java reflection to gain access to TelephonyManager’s // ITelephony getter Class c = Class.forName(tm.getClass().getName()); Method m = c.getDeclaredMethod(“getITelephony”); m.setAccessible(true); telephonyService = (ITelephony)m.invoke(tm); all all all of hundreds … Read more