0
votes

Ok, some of my custom says that my APP sometime didn't play notification sound while received GCM push message...(Phone is samsung galaxy s3 and I'm pretty sure the phone is in RING mode, not in silent or vibrate mode)

I thought maybe they didn't select any file as notification sound, so I change my code to play default sound only.

Here's my code to play default notification sound :

    Ringtone r=null;
    try
    {
      Uri uri=RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
      r=RingtoneManager.getRingtone(getApplicationContext(), uri);
      r.play();
    }
    catch(Exception e)
    {e.printStackTrace();}

So I get their s3, and see what's going on.

BUT, no any error message, no any error stack comes out, it just didn't play default notification sound...

Android device(s) I did tried :

  • HTC Butterfly (exactly same module called DroidDNA in United States)
  • HTC DesireHD
  • HTC Desire
  • acer A100(7" tablet)
  • samsung note2

Above 5 devices are playing notificatoin sound well.

Why samsung s3 didn't playback notification sound sometime......

Any ideas ?

1

1 Answers

0
votes

I still don't know why Samsung's android phone causes this problem, while HTC & Acer are working well

I did fix this problem with the following code :

PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
Notification notification = new Notification(R.drawable.icon_notify, tickerText, when);
if (allow play notify) {
    notification.defaults |= Notification.DEFAULT_SOUND;
}
if (allow vibrate) {
    notification.defaults |= Notification.DEFAULT_VIBRATE;
}

So I guess I can't attach my own notification sound to my App