Upload
rashad-aliyev
View
1.956
Download
2
Embed Size (px)
DESCRIPTION
Telephony APIRamin Orujov
Citation preview
Telephony APIRamin Orujov
22.04.2012
Agenda
• API overview• Working with SMS• Working with phone calls• Working with MMS
API Overview
• http://developer.android.com/reference/android/telephony/package-summary.html
SMS
Permissions:• android.permission.SEND_SMS• android.permission.RECEIVE_SMSMain classes: • SmsManager• SmsMessage
SMS
How to send sms• Get SmsManager instanceSmsManager m = SmsManager.getDefault();• Send text smsvoid sendTextMessage (String
destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntentdeliveryIntent)
SMS
How to read incoming smsExtends BroadcastReceiver and listen for actionandroid.provider.Telephony.SMS_RECEIVED
How to get sent and delivery reportPendingIntent for both actions
SMS
• API docshttp://developer.android.com/reference/android/telephony/SmsManager.html
Phone call
• Call number• Detect incoming and outgoing calls• Listen phone state changes
Phone call
How to call numberIntent intent = new Intent(Intent.ACTION_CALL,
Uri.parse("tel:502310109")); startActivity(intent);
Permission:• android.permission.CALL_PHONE
Phone call
How to detect incoming and outgoing calls• Extend BroadcastReceiver and listen for action android.intent.action.PHONE_STATEandroid.intent.action.NEW_OUTGOING_CALL
Phone call
• How to get phone state change eventsPermissions• android.permission.READ_PHONE_STATE• android.permission.ACCESS_COARSE_LOCATION• android.permission.ACCESS_NETWORK_STATE• android.permission.ACCESS_COARSE_UPDATES
Phone call
• API docshttp://developer.android.com/reference/android/telephony/TelephonyManager.html
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);
References
Pro Android 4 bookhttp://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/TelephonyManager.html
http://www.tested.com/news/how-to/articles/557-how-to-measure-cell-signal-strength-on-android-phones/
Questions?
Contact me
http://raminorucov.wordpress.comhttp://www.facebook.com/ramin.orucovhttp://www.linkedin.com/in/raminorujov http://twitter.com/RaminOrujov