If your application intends to continue playing audio in the backgroun dịch - If your application intends to continue playing audio in the backgroun Việt làm thế nào để nói

If your application intends to cont

If your application intends to continue playing audio in the background when the Activity isn’t visible, a good approach is to keep your Media Player within a Service, controlling the media playback using Intents.
Multiple applications might be installed on a given device, each configured to receive media key presses; therefore, you must also use the Audio Manager’s registerMediaButtonEventReceiver method to register your Receiver as the exclusive handler of media button presses, as shown in Listing 15-10, which both registers the media button event Receiver declared in your manifest and the local Broadcast Receiver that interprets the Intent when it’s passed through to the Activity.


LISTING 15-10: Media button press Receiver manifest declaration
// Register the Media Button Event Receiver to
// listen for media button presses.
AudioManager am =
(AudioManager)getSystemService(Context.AUDIO_SERVICE); ComponentName component =
new ComponentName(this, MediaControlReceiver.class);


am.registerMediaButtonEventReceiver(component);
// Register a local Intent Receiver that receives media button // presses from the Receiver registered in the manifest. activityMediaControlReceiver = new ActivityMediaControlReceiver(); IntentFilter filter =
new IntentFilter(MediaControlReceiver.ACTION_MEDIA_BUTTON);
registerReceiver(activityMediaControlReceiver, filter);
code snippet PA4AD_Ch15_Media_Player/src/AudioPlayerActivity.java

0/5000
Từ: -
Sang: -
Kết quả (Việt) 1: [Sao chép]
Sao chép!
If your application intends to continue playing audio in the background when the Activity isn’t visible, a good approach is to keep your Media Player within a Service, controlling the media playback using Intents.Multiple applications might be installed on a given device, each configured to receive media key presses; therefore, you must also use the Audio Manager’s registerMediaButtonEventReceiver method to register your Receiver as the exclusive handler of media button presses, as shown in Listing 15-10, which both registers the media button event Receiver declared in your manifest and the local Broadcast Receiver that interprets the Intent when it’s passed through to the Activity. LISTING 15-10: Media button press Receiver manifest declaration // Register the Media Button Event Receiver to // listen for media button presses.AudioManager am =(AudioManager)getSystemService(Context.AUDIO_SERVICE); ComponentName component =new ComponentName(this, MediaControlReceiver.class); am.registerMediaButtonEventReceiver(component);// Register a local Intent Receiver that receives media button // presses from the Receiver registered in the manifest. activityMediaControlReceiver = new ActivityMediaControlReceiver(); IntentFilter filter =new IntentFilter(MediaControlReceiver.ACTION_MEDIA_BUTTON);registerReceiver(activityMediaControlReceiver, filter); code snippet PA4AD_Ch15_Media_Player/src/AudioPlayerActivity.java
đang được dịch, vui lòng đợi..
Kết quả (Việt) 2:[Sao chép]
Sao chép!
Nếu ứng dụng của bạn có ý định tiếp tục phát âm thanh trong khi nền tảng của hoạt động là không thể nhìn thấy, một cách tiếp cận tốt là giữ Media Player của bạn trong vòng một Dịch vụ, kiểm soát các phương tiện truyền thông phát lại sử dụng Intents.
Nhiều ứng dụng có thể được cài đặt trên một thiết bị nhất định, mỗi cấu hình để nhận ép chính phương tiện truyền thông; do đó, bạn cũng phải sử dụng phương pháp registerMediaButtonEventReceiver Manager Audio để đăng ký nhận của bạn như là xử lý độc quyền của nút ép phương tiện truyền thông, như thể hiện trong Liệt kê 15-10, cả hai đăng ký các sự kiện truyền thông nút nhận kê khai trong biểu hiện của bạn và Broadcast Receiver địa phương diễn giải ý định khi nó được thông qua thông qua các hoạt động. NIÊM YẾT 15-10: Media nút bấm nhận khai manifest // đăng ký truyền thông tổ chức sự kiện nút Receiver để . // nghe cho nút bấm truyền thông AudioManager am = (AudioManager) getSystemService (Context.AUDIO_SERVICE ); ComponentName thành phần = mới ComponentName (this, MediaControlReceiver.class); am.registerMediaButtonEventReceiver (thành phần); // Đăng ký một nhận Ý định địa phương tiếp nhận phương tiện truyền thông nút // ép từ bộ nhận đăng ký trong biểu hiện. activityMediaControlReceiver = new ActivityMediaControlReceiver (); IntentFilter lọc = mới bộ lọc); đoạn mã PA4AD_Ch15_Media_Player / src / AudioPlayerActivity.java
















đang được dịch, vui lòng đợi..
 
Các ngôn ngữ khác
Hỗ trợ công cụ dịch thuật: Albania, Amharic, Anh, Armenia, Azerbaijan, Ba Lan, Ba Tư, Bantu, Basque, Belarus, Bengal, Bosnia, Bulgaria, Bồ Đào Nha, Catalan, Cebuano, Chichewa, Corsi, Creole (Haiti), Croatia, Do Thái, Estonia, Filipino, Frisia, Gael Scotland, Galicia, George, Gujarat, Hausa, Hawaii, Hindi, Hmong, Hungary, Hy Lạp, Hà Lan, Hà Lan (Nam Phi), Hàn, Iceland, Igbo, Ireland, Java, Kannada, Kazakh, Khmer, Kinyarwanda, Klingon, Kurd, Kyrgyz, Latinh, Latvia, Litva, Luxembourg, Lào, Macedonia, Malagasy, Malayalam, Malta, Maori, Marathi, Myanmar, Mã Lai, Mông Cổ, Na Uy, Nepal, Nga, Nhật, Odia (Oriya), Pashto, Pháp, Phát hiện ngôn ngữ, Phần Lan, Punjab, Quốc tế ngữ, Rumani, Samoa, Serbia, Sesotho, Shona, Sindhi, Sinhala, Slovak, Slovenia, Somali, Sunda, Swahili, Séc, Tajik, Tamil, Tatar, Telugu, Thái, Thổ Nhĩ Kỳ, Thụy Điển, Tiếng Indonesia, Tiếng Ý, Trung, Trung (Phồn thể), Turkmen, Tây Ban Nha, Ukraina, Urdu, Uyghur, Uzbek, Việt, Xứ Wales, Yiddish, Yoruba, Zulu, Đan Mạch, Đức, Ả Rập, dịch ngôn ngữ.

Copyright ©2025 I Love Translation. All reserved.

E-mail: