Telephony API

2,860 views
2,896 views

Published on

Telephony API
Ramin Orujov

Published in: Technology, Business
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,860
On SlideShare
0
From Embeds
0
Number of Embeds
143
Actions
Shares
0
Downloads
323
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

Telephony API

  1. 1. Telephony API Ramin Orujov 22.04.2012
  2. 2. Agenda• API overview• Working with SMS• Working with phone calls• Working with MMS
  3. 3. API Overview• http://developer.android.com/reference/andr oid/telephony/package-summary.html
  4. 4. SMSPermissions:• android.permission.SEND_SMS• android.permission.RECEIVE_SMSMain classes:• SmsManager• SmsMessage
  5. 5. SMSHow to send sms• Get SmsManager instanceSmsManager m = SmsManager.getDefault();• Send text smsvoid sendTextMessage (String destinationAddre ss, String scAddress, String text, PendingIntent sentIntent, PendingIntentdeliveryIntent)
  6. 6. SMSHow to read incoming smsExtends BroadcastReceiver and listen for actionandroid.provider.Telephony.SMS_RECEIVEDHow to get sent and delivery reportPendingIntent for both actions
  7. 7. SMS• API docshttp://developer.android.com/reference/androi d/telephony/SmsManager.html
  8. 8. Phone call• Call number• Detect incoming and outgoing calls• Listen phone state changes
  9. 9. Phone callHow to call numberIntent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:502310109")); startActivity(intent);Permission:• android.permission.CALL_PHONE
  10. 10. Phone callHow to detect incoming and outgoing calls• Extend BroadcastReceiver and listen for actionandroid.intent.action.PHONE_STATEandroid.intent.action.NEW_OUTGOING_CALL
  11. 11. 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
  12. 12. Phone call• API docshttp://developer.android.com/reference/androi d/telephony/TelephonyManager.html
  13. 13. MMSUri 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. 14. ReferencesPro Android 4 bookhttp://www.amazon.com/Pro-Android-4-Professional-Apress/dp/1430239301/http://mobiforge.com/developing/story/sms-messaging-androidhttp://developer.android.com/reference/android/telephony/TelephonyManager.htmlhttp://www.tested.com/news/how-to/articles/557-how-to-measure-cell-signal-strength-on-android-phones/
  15. 15. Questions?
  16. 16. Contact mehttp://raminorucov.wordpress.comhttp://www.facebook.com/ramin.orucovhttp://www.linkedin.com/in/raminorujovhttp://twitter.com/RaminOrujov

×