Skip to content

Instantly share code, notes, and snippets.

@tosunkaya
Forked from maxost/AndroidUtils.kt
Created July 13, 2021 17:42
Show Gist options
  • Save tosunkaya/6eacd21c7a9dd20becae5ff891ba97c6 to your computer and use it in GitHub Desktop.
Save tosunkaya/6eacd21c7a9dd20becae5ff891ba97c6 to your computer and use it in GitHub Desktop.
Kotlin: make phone call in Android
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