Bài giảng Lập trình cho thiết bị di động: Chương 6 - ĐH Công nghê Đồng Nai
Số trang: 45
Loại file: pptx
Dung lượng: 1.43 MB
Lượt xem: 12
Lượt tải: 0
Xem trước 5 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Bài giảng Lập trình cho thiết bị di động: Chương 6 - Telephony APIs VÀ Location base services APIs có nội dung trình bày về Telephony APIs và LBS APIs. Tham khảo nội dung bài giảng để hiểu rõ hơn về các nội dung trên.
Nội dung trích xuất từ tài liệu:
Bài giảng Lập trình cho thiết bị di động: Chương 6 - ĐH Công nghê Đồng Nai DONG NAI UNIVERSITY OF TECHNOLOGY API 1 2Telephony LBS APIs APIs 1 DONG NAI UNIVERSITY OF TECHNOLOGY1. Telephony APIs 1.1 Working with Telephony Utilities 1.2 Using SMS 1.3 Making and Receiving Phone Calls 2 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony UtilitiesØ If your application uses telephony features, make sure you set the tag with the android.hardware.telephony feature (or one of its sub- features) in your application’s manifest file to ensure your application is installed only on compatible devices.Read more Hardware Features:http://developer.android.com/guide/topics/manifest/uses-feature-elem 3 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony UtilitiesØ Gaining Permission to Access Phone State Information ü You can use the TelephonyManager object to retrieve the state of the phone and some information about the phone service itself, such as the phone number of the handset. Read more details: http:// developer.android.com/reference/android/telephony/Telephon 4 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony Utilities Ø Cont… 5 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony Utilities Ø Cont…Ø Listening for changes in the call state can enable an application to react appropriately to something the user might be doing. For instance, a game might automatically pause and save state information when the phone rings so that the user can safely answer the call.Ø An application can register to listen for changes in the call state by making a call to the listen() method of TelephonyManager. 6 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony Utilities Ø Cont… 7 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony Utilities Ø Cont… 8 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony UtilitiesØ Get telephony service Add the PhoneStateListener.LISTEN_SERVICE_STATE flag to the listener described earlier and implement the onServiceStateChanged method, which receives an instance of the ServiceState object. 9 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony Utilities Ø Cont… 10 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony UtilitiesØ Working with Phone Numbers The resulting output to the log would be the string “999-555-1212” ü Check the phone number is an emergency phone number by calling PhoneNumberUtils.isEmergencyNumber() 11 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony UtilitiesØ Working with Phone Numbers The formatNumber() method can also take an Editable as a parameter to format a number in place.The useful feature here is that you can assign the PhoneNumberFormattingTextWatcher object to watch a TextView (or EditText for user input) and format phone numbers as they are entered. 12 DONG NAI UNIVERSITY OF TECHNOLOGY1.2 Using SMSØ Gaining Permission to Send and Receive SMS Messages SMS functionality requires two different permissions, depending on whether the application sends or receives messages 13 DONG NAI UNIVERSITY OF TECHNOLOGY1.2 Using SMSØ Sending an SMS To send an ...
Nội dung trích xuất từ tài liệu:
Bài giảng Lập trình cho thiết bị di động: Chương 6 - ĐH Công nghê Đồng Nai DONG NAI UNIVERSITY OF TECHNOLOGY API 1 2Telephony LBS APIs APIs 1 DONG NAI UNIVERSITY OF TECHNOLOGY1. Telephony APIs 1.1 Working with Telephony Utilities 1.2 Using SMS 1.3 Making and Receiving Phone Calls 2 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony UtilitiesØ If your application uses telephony features, make sure you set the tag with the android.hardware.telephony feature (or one of its sub- features) in your application’s manifest file to ensure your application is installed only on compatible devices.Read more Hardware Features:http://developer.android.com/guide/topics/manifest/uses-feature-elem 3 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony UtilitiesØ Gaining Permission to Access Phone State Information ü You can use the TelephonyManager object to retrieve the state of the phone and some information about the phone service itself, such as the phone number of the handset. Read more details: http:// developer.android.com/reference/android/telephony/Telephon 4 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony Utilities Ø Cont… 5 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony Utilities Ø Cont…Ø Listening for changes in the call state can enable an application to react appropriately to something the user might be doing. For instance, a game might automatically pause and save state information when the phone rings so that the user can safely answer the call.Ø An application can register to listen for changes in the call state by making a call to the listen() method of TelephonyManager. 6 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony Utilities Ø Cont… 7 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony Utilities Ø Cont… 8 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony UtilitiesØ Get telephony service Add the PhoneStateListener.LISTEN_SERVICE_STATE flag to the listener described earlier and implement the onServiceStateChanged method, which receives an instance of the ServiceState object. 9 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony Utilities Ø Cont… 10 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony UtilitiesØ Working with Phone Numbers The resulting output to the log would be the string “999-555-1212” ü Check the phone number is an emergency phone number by calling PhoneNumberUtils.isEmergencyNumber() 11 DONG NAI UNIVERSITY OF TECHNOLOGY1.1 Working with Telephony UtilitiesØ Working with Phone Numbers The formatNumber() method can also take an Editable as a parameter to format a number in place.The useful feature here is that you can assign the PhoneNumberFormattingTextWatcher object to watch a TextView (or EditText for user input) and format phone numbers as they are entered. 12 DONG NAI UNIVERSITY OF TECHNOLOGY1.2 Using SMSØ Gaining Permission to Send and Receive SMS Messages SMS functionality requires two different permissions, depending on whether the application sends or receives messages 13 DONG NAI UNIVERSITY OF TECHNOLOGY1.2 Using SMSØ Sending an SMS To send an ...
Tìm kiếm theo từ khóa liên quan:
Thiết bị di động Kỹ thuật lập trình Điện thoại di động Lập trình điện thoại Giao diện người dùng Xử lý tập tinTài liệu có liên quan:
-
Bài giảng Phân tích thiết kế hệ thống thông tin: Chương 3 - Hệ điều hành Windowns XP
39 trang 386 0 0 -
Kỹ thuật lập trình trên Visual Basic 2005
148 trang 310 0 0 -
NGÂN HÀNG CÂU HỎI TRẮC NGHIỆM THIẾT KẾ WEB
8 trang 248 0 0 -
43 trang 223 0 0
-
Giới thiệu môn học Ngôn ngữ lập trình C++
5 trang 222 0 0 -
Bài giảng Nhập môn về lập trình - Chương 1: Giới thiệu về máy tính và lập trình
30 trang 189 0 0 -
72 trang 181 0 0
-
Luận văn: Nghiên cứu kỹ thuật giấu tin trong ảnh Gif
33 trang 159 0 0 -
Đồ án tốt nghiệp ngành Công nghệ thông tin: Lập trình game trên thiết bị di động
56 trang 157 0 0 -
33 trang 147 0 0