Skip to content

Commit

Permalink
started adding sms support.
Browse files Browse the repository at this point in the history
  • Loading branch information
robgruen committed Nov 1, 2024
1 parent 3bacfa7 commit 98aae24
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions android/samples/mobile/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.SEND_SMS" />

<uses-feature android:name="android.hardware.camera.any" android:required="true" />
<uses-feature
android:name="android.hardware.telephony"
android:required="false" />

<application
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,12 @@ class JavaScriptInterface(var context: Context) {
val intent = Intent(Intent.ACTION_CALL, Uri.parse(uri))
startActivity(context, intent, null);
}

@JavascriptInterface
fun sendSMS(phoneNumber: String, message: String) {
val uri = String.format(Locale.ROOT, "smsto:%s", phoneNumber)
val intent = Intent(Intent.ACTION_SENDTO, Uri.parse(uri))
.putExtra("sms_body", message);
startActivity(context, intent, null)
}
}

0 comments on commit 98aae24

Please sign in to comment.