Practical 7
Practical 7
Faculty of Technology
Department of Information and Communication Technology
Subject: Mobile and Pervasive Aim: Develop an application that auto sends received SMS.
Computing [01CT0716]
CODE:-
MainActivity.kt:-
sendButton.setOnClickListener {
val phoneNumber = phoneNumberEditText.text.toString().trim()
var message = messageEditText.text.toString().trim()
if (phoneNumber.isEmpty() || message.isEmpty()) {
Toast.makeText(this, "Please enter both phone number and message", Toast.LENGTH_SHORT).show()
return@setOnClickListener
}
1|Page
Marwadi University
Faculty of Technology
Department of Information and Communication Technology
Subject: Mobile and Pervasive Aim: Develop an application that auto sends received SMS.
Computing [01CT0716]
SMS_PERMISSION_CODE)
} else {
sendSMS(phoneNumber, message)
}
}
}
2|Page
Marwadi University
Faculty of Technology
Department of Information and Communication Technology
Subject: Mobile and Pervasive Aim: Develop an application that auto sends received SMS.
Computing [01CT0716]
AndroidManifest.xml
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.SMSApp"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</manifest>
3|Page
Marwadi University
Faculty of Technology
Department of Information and Communication Technology
Subject: Mobile and Pervasive Aim: Develop an application that auto sends received SMS.
Computing [01CT0716]
Output:-
4|Page