I have searched for this, so apologies if this has been answered already (I am happy to be redirected), but specifically our issue is intermittent.
Our clients are complaining that the notification audio is, intermittently, not 'chiming' when an event is sent to their phones from our software. It will work fine for a time, then 'just stop for a few hours' (extrapolating from the complaints of our customers).
We've not been able to reproduce this in house, but the frustration we are getting from our customers is such that we really need to fix it.
Our customers insist they are not making phone calls, playing audio or running other software, and from seeing their phones, I largely believe them.
We have noticed this largely on Jellybean, as this is what most of our clients are running, however it may not be isolated to this case.
Am I doing something wrong, or is there a better way to 'chime' for a notification. At this stage I am happy to try something different
void updateNotification()
{
Notification.Builder builder = new Notification.Builder(_context);
// Set the appearance of the notification:
int icon;
String title;
String description;
// ...
//CODE setting icon, title and description
// ...
builder.setSmallIcon(icon);
builder.setContentTitle(title);
builder.setContentText(description);
builder.setTicker(description);
// Set the sound for the notification:
builder.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM));
Intent intent = new Intent(_context, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra(MainActivity.EXTRA_TAB, MainActivity.EXTRA_TAB_TASKS);
builder.setContentIntent(PendingIntent.getActivity(_context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT));
// Update the notification:
NotificationManager manager = (NotificationManager)_context.getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(_notificationId, builder.build());
}
Source: View source