开发者

how can i play a sound when device receive an C2DM message

开发者 https://www.devze.com 2023-04-05 16:10 出处:网络
i have read for hours about how to start play a sound the way i wan开发者_StackOverflow中文版t but i cannot find an answer.

i have read for hours about how to start play a sound the way i wan开发者_StackOverflow中文版t

but i cannot find an answer.

Here goes,

When device receive a C2DM push im displaying a Notification.

User can click the Notficationand my activity start.

Everything works grate.

Now I would like to create a phone-call-type of ring-sound

so it sounds like there's an incoming Voice call.

User pick up phone and notice my Notification presses it

and the sound stop playing.

Or even better, the C2DM message trigger my activity to start with a phone-call-type of ring-sound.

When user touch the phone the sound stop playing

any help in any direction would be grate


Set the sound data member of your Notification to a Uri pointing to the ringtone you want to have played when the Notification is displayed. Ideally, you let the user pick their own ringtone (e.g., via a RingtonePreference) rather than forcing a certain ringtone on them.

Or even better, the C2DM message trigger my activity to start with a phone-call-type of ring-sound.

Popping up an activity like this, when the user might be in the middle of something else, is infrequently a good idea.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号