5. SMS
How to send sms
• Get SmsManager instance
SmsManager m = SmsManager.getDefault();
• Send text sms
void sendTextMessage (String destinationAddre
ss, String scAddress, String text, PendingIntent
sentIntent, PendingIntentdeliveryIntent)
6. SMS
How to read incoming sms
Extends BroadcastReceiver and listen for action
android.provider.Telephony.SMS_RECEIVED
How to get sent and delivery report
PendingIntent for both actions
8. Phone call
• Call number
• Detect incoming and outgoing calls
• Listen phone state changes
9. Phone call
How to call number
Intent intent = new Intent(Intent.ACTION_CALL,
Uri.parse("tel:502310109"));
startActivity(intent);
Permission:
• android.permission.CALL_PHONE
10. Phone call
How to detect incoming and outgoing calls
• Extend BroadcastReceiver and listen for action
android.intent.action.PHONE_STATE
android.intent.action.NEW_OUTGOING_CALL
11. Phone call
• How to get phone state change events
Permissions
• android.permission.READ_PHONE_STATE
• android.permission.ACCESS_COARSE_LOCATION
• android.permission.ACCESS_NETWORK_STATE
• android.permission.ACCESS_COARSE_UPDATES
12. Phone call
• API docs
http://developer.android.com/reference/androi
d/telephony/TelephonyManager.html
13. MMS
Uri mmsUri =
Uri.parse("content://media/external/images/media/1");
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra("sms_body", “This is a test mms ");
intent.putExtra(Intent.EXTRA_STREAM, mmsUri);
intent.setType("image/png");
startActivity(intent);
14. References
Pro Android 4 book
http://www.amazon.com/Pro-Android-4-Professional-
Apress/dp/1430239301/
http://mobiforge.com/developing/story/sms-messaging-android
http://developer.android.com/reference/android/telephony/Tele
phonyManager.html
http://www.tested.com/news/how-to/articles/557-how-to-
measure-cell-signal-strength-on-android-phones/