Reputation: 4115
In my android application, I want to notify the user with a sound without showing the notification. Is that possible ?
Notification n = new Notification();
n.icon = com.android.mms.R.drawable.wap_message;
n.defaults |= Notification.DEFAULT_SOUND;
n.flags = Notification.FLAG_AUTO_CANCEL;
This is the code I am using to show the notification, So I commented icon and flags of the notification as follows
Notification n = new Notification();
//n.icon = com.android.mms.R.drawable.wap_message;
n.defaults |= Notification.DEFAULT_SOUND;
//n.flags = Notification.FLAG_AUTO_CANCEL;
But it is not working.
Upvotes: 1
Views: 662
Reputation: 4839
why don't you use MediaPlayer
instead of Notification
to play the notification sound. If you use the Notication then it shows the icon. In your case using the MediaPlayer
is better option.
Upvotes: 1