Android Telephony Manager and SMS
Click here to load reader
-
Upload
jussi-pohjolainen -
Category
Technology
-
view
7.324 -
download
1
Transcript of Android Telephony Manager and SMS
Android Telephony and Messaging
Jussi Pohjolainen
Overview
• Telephone API is used monitor phone informa=on – States of phone, connec=on
• Available in package android.telephony • Classes like: SmsManager, TelephonyManager
TelephonyManager
• Class to determine telephony services and states – IDLE, RINGING, DATA_CONNECTED…
• App can register to receive no=fica=ons of state changes
• Some telephony informa=on needs permissions to be set in the manifest: – <uses-permission android:name="android.permission.READ_PHONE_STATE” />
Example
LISTEN_DATA_ACTIVITY LISTEN_SIGNAL_STRENGTHS
…
SmsManager
• Manages SMS opera=ons such as sending data, text, and pdu SMS messages.
• Get this object by calling the sta=c method SmsManager.getDefault().
• Add permission: android.permission.SEND_SMS
Sending SMS
(SmsManager.getDefault()).sendTextMessage("+3585012345", null, “message”, null, null);
Receiving SMS <receiver android:name=".SmsReceiver"> <intent-‐filter> <ac=on android:name= "android.provider.Telephony.SMS_RECEIVED" /> </intent-‐filter> </receiver>
Receiving SMS