-
-
Save tosunkaya/6eacd21c7a9dd20becae5ff891ba97c6 to your computer and use it in GitHub Desktop.
Kotlin: make phone call in Android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun Context.makePhoneCall(number: String) : Boolean { | |
try { | |
val intent = Intent(Intent.ACTION_DIAL, Uri.parse("tel:$number")) | |
startActivity(intent) | |
return true | |
} catch (e: Exception) { | |
e.printStackTrace() | |
return false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment