Upload presentasi
Presentasi sedang didownload. Silahkan tunggu
1
SMS Programming Teguh Sutanto
2
SMS API & Built in sms app
SmsManager API SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTextMessage("phoneNo", null, "sms message", null, null); Built-in SMS application Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.putExtra("sms_body", "default content"); sendIntent.setType("vnd.android-dir/mms-sms"); startActivity(sendIntent);
3
We can send SMS in 2 ways - with Intent or without Intent.
Any SMS sending requires add android.permission.SEND_SMS permission to the manifest: <uses-permission android:name="android.permission.SEND_SMS"/>
4
Directly Through Built-In SM Application
/* Phone Number is just all digits of the number (including country code) strPhone = “ "; strMessage = “Test Kirim SMS"; Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.setType("vnd.android-dir/mms-sms"); sendIntent.putExtra("address", strPhone); sendIntent.putExtra("sms_body", strMessage); startActivity(sendIntent);
5
Prj: SMsApp
7
Handling Smsto: Protocol
Format penulisan Protokol "smsto:+XXXXXXXXXXX" Requires android.permission.SEND_SMS permission. strPhone = “+62856xxx; Uri sms_uri = Uri.parse("smsto:+" + strPhone); Intent sms_intent = new Intent(Intent.ACTION_SENDTO, sms_uri); sms_intent.putExtra("sms_body", txtPesan.getText().toString()); startActivity(sms_intent);
8
kirimsmsprotokol
10
Without Intent (Silently, Without UI)
SmsManager.sendTextMessage() Requires android.permission.SEND_SMS permission String strPhone = “+628XXX"; String strMessage = “ISI PESAN\nSMS"; SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(strPhone, null, strMessage, null, null); Toast.makeText(this, "Sent.",Toast.LENGTH_SHORT).show();
11
Kirimsms-silent
13
smsmanager
14
Menerima sms <manifest ...> <uses-sdk .../> <uses-permission android:name="android.permission.RECEIVE_SMS"/> <application ...> </manifest>
15
PenerimaSMS turunan dari BroadcastReciever
Tambah class PenerimaSMS turunan dari BroadcastReciever
16
Definiskan ulang method onrecieve
19
Atur manifest
20
NEXT Buat proposal untuk Tugas Akhir Mata Kuliah Pemrograman Aplikasi Mobile dikumpulkan pada pertemuan ke-14 Aplikasi yang dibuat harus menggunakan: JSON HttpUrlConnection SQLite SMS View2
Presentasi serupa
© 2024 SlidePlayer.info Inc.
All rights reserved.