I am making an application that should notify the user making a call that the call lasts ... Everything works for me, and the notification is made at the right time (I see it in the status bar), but without sound. If I call a notification when there is no call, the sound is played.
My notification is as follows:
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
int icon = R.drawable.icon;
CharSequence tickerText = "Hello From CallTimerService";
long when = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, when);
Context context = getApplicationContext();
CharSequence contentTitle = "My notification";
CharSequence contentText = "ss";
Intent notificationIntent = new Intent(this, CallTimer.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
notification.defaults = Notification.DEFAULT_SOUND;
notification.flags |= Notification.FLAG_AUTO_CANCEL;
mNotificationManager.notify(2, notification);
I also tried changing the .audioStreamType notification using AudioManager.STREAM_, but no luck.
Now, how to do this, any body? or just a good idea, what to try next ....
source
share