开发者

Android Notifications: use Email sound and Reminder sound instead of Default (text message?) sound

开发者 https://www.devze.com 2023-02-20 08:26 出处:网络
I am using the emulator so I don\'t know what sounds it makes, but according to one customer (not tech savvy), the sound it is making is the same as text messages.

I am using the emulator so I don't know what sounds it makes, but according to one customer (not tech savvy), the sound it is making is the same as text messages.

Here is the code I am using

Notification notification = new Notification(R.drawable.stat_notify_email_generic, "New Email", timeInMillis);
if (soundAndVibrate)
    notification.defaults |= Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE;
notification.defaults |= Notification.DEFAULT_LIGHTS;
notification.flags |= Notification.FLAG_AUTO_CANCEL;
Intent notificationIntent = new Intent(Intent.ACTION_MAIN, Uri.EMPTY, context, MyActivityFoo.class).putExtra(......
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, cont开发者_C百科entText, contentIntent);
manager.notify(1, notification);

How would I change it to use the New Email sound? since it is in fact an email notification. Also I would like similar instructions to make the same sound as the Calendar Alarm/Reminder.

0

精彩评论

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