how can i play a sound when device receive an C2DM message
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 aNotification
.
User can click the Notfication
and 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
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.
精彩评论