Android SMS - How to Send Sms in Android Studio using Kotlin.
Android Send SMS using Android Intent kotlin code
In this android example, we will see how to send message from app in Android Studio by using Kotlin Language.
Implementation:
Create a new Project in android studio.
| Go to File > New > New Project > Empty Activity > Next > Enter Name > Select Language Kotlin > Finish |
Go to activity_message.xml file and add the following code
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <EditText <Button </LinearLayout> |
Add Send SMS permission in AndroidManifest.xml file
Open MessageActivity.kt file and add the following code below setContentView().
|
val btn = findViewById(R.id.sendSMS)
fun myMessage() { btn.setOnClickListener { val permissionCheck = }
|
Run the app on emulator or real device, you will get the output as following in video .
Complete Source Code of Send SMS Example :
activity_message.xml file
|
<?xml version="1.0" encoding="utf-8"?> <EditText <Button </LinearLayout> |
MessageActivity.kt file
|
import android.Manifest
fun myMessage() { btn.setOnClickListener { val permissionCheck = } }
|
Conclusion: In this article we have covered how to send message from app in Android Studio by using Kotlin Language.