TAILIEUCHUNG - Lập trình Androi part 44

Pop-up thông báo, khay biểu tượng với bong bóng của họ "liên quan" tin nhắn, nảy lên biểu tượng dock, vv-bạn đang không có nghi ngờ sử dụng để chương trình cố gắng để có được sự chú ý của bạn, đôi khi vì một lý do tốt. Điện thoại của bạn cũng có thể là lúc bạn chirps cho các cuộc gọi nhiều hơn là chỉ đến: pin thấp, đồng hồ báo thức, thông báo bổ nhiệm, tin nhắn văn bản đến, và như vậy. | Chapter Alerting Users via Notifications Pop-up messages tray icons with their associated bubble messages bouncing dock icons and so on you are no doubt used to programs trying to get your attention sometimes for good reason. Your phone also probably chirps at you for more than just incoming calls low battery alarm clocks appointment notifications incoming text messages and so on. Not surprisingly Android has a whole framework for dealing with these sorts of alerts collectively called notifications which is the subject of this chapter. Types of Pestering A service running in the background needs a way to let users know something of interest has occurred such as when e-mail has been received. Moreover the service may need some way to steer users to an activity where they can act on the event such as reading a received message. For this Android supplies status bar icons flashing lights and other indicators collectively known as notifications . Your current phone may already have such icons to indicate battery life signal strength whether Bluetooth is enabled and the like. With Android applications can add their own status bar icons with an eye toward having them appear only when needed . a message has arrived . In Android you can raise notifications via the NotificationManager. The NotificationManager is a system service. To use it you need to get the service object via getSystemService NOTIFICATION_SERVICE from your activity. The NotificationManager gives you three methods one to pester notify and two to stop pestering cancel and cancelAll . 289 CHAPTER 31 Alerting Users via Notifications The notify method takes a Notification which is a data structure that spells out the form your pestering should take. The capabilities of this object are described in the following sections. Hardware Notifications You can flash LEDs on the device by setting lights to true also specifying the color as an ARGB value in ledARGB and the pattern in which the light should blink by .

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.