TAILIEUCHUNG - Android SDK (phần 8)

Introducing Notifications ❘ 317 As each enhancement is described, you will be provided with a code snippet that can be added to the Earthquake example to provide user feedback on the severity of each earthquake as it’s detected. To use the Notification techniques described here without also displaying the status bar icon, simply cancel the Notification directly after triggering it. This stops the icon from displaying but doesn’t interrupt the other effects. Using the Defaults The simplest and most consistent way to add sound, light, and vibration to your Notifications is to use the current user default settings. Using the defaults property you can. | Introducing Notifications 317 As each enhancement is described you will be provided with a code snippet that can be added to the Earthquake example to provide user feedback on the severity of each earthquake as it s detected. 2h To use he Notification tecl es described here without also the s ahs o use e ocaon cc nqucs esere e e wou asu spayng e sMi Uc bar icon simply cancel the Notification directly after triggering it. This stops the icon from displaying but doesn t interrupt the other effects. Using the Defaults The simplest and most consistent way to add sound light and vibration to your Notifications is to use the current user default settings. Using the defaults property you can combine The following code snippet assigns the default sound and vibration settings to a Notification If you want to use all the default values you can use the constant. Making Sounds Using an audio alert to notify the user of a device event like incoming calls is a technique that predates the mobile and has stood the test of time. Most native phone events from incoming calls to new messages and low battery are announced by audible ringtones. Android lets you play any audio file on the phone as a Notification by assigning a location URI to the sound property as shown in the following snippet ringURI To use your own custom audio push the file onto your device or include it as a raw resource as described in Chapter 11. The following snippet can be added to the announceNewQuake method within the Earthquake Service from the earlier example. It adds an audio component to the earthquake Notification ringing the default notification ringtone if a significant earthquake one with a magnitude greater than 6 occurs. if 6 Uri ringURI .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.