android - Why are my notifications sometimes silent with ringtone from SD card? -


I am using information in my simple timer app (initial testing phase), and found that maybe 5% to 20 The time when I removed a notification, the sound did not come. Notification was shown correctly in all other cases, including LED flash, but was silent. I have confirmed with the temporary additional log lines that the sound URI I am using is sensible, and in reality there are similarities in the cases that do not work and which do not matter, I will briefly summarize the code of establishment notification , If I'm stupid somewhat monologically:

  // at the place where the receiver () calls from ... notification manager notifications ... ...; Notification n = new notification (Arrayable.con, text, next millisecence); N.setLatestEventInfo (...); N.flags = Notice. FLAG_NO_CLEAR | FLAG_SHOW_LIGHTS; N.OldOnMS = 250; N.ledOffMS = 1250; N.ledARGB = 0xff2222ff; N.audioStreamType = Audio Manager. STREAM_ALARM; N.sound = myUri; Notifications Information (int id, n); Here is the only common factor I found here is that in problematic cases, the phone was asleep (the screen turned off for more than 30 seconds), one woke up from the notification. Failure mode which comes to mind, is that the device goes back to sleep very quickly, but does not say anything in a logical way, in fact, I do not see any difference between success and the sound lost. In an effort to work on sleep issues, if any, I have temporarily added this wake lock:  
  + PowerManager.WakeLock wl = pm.newWakeLock (PowerManager.PARTIAL_WAKE_LOCK , "Timer"); + Wl.acquire (); + Log D. (Timer Activity. TAG "World Lock Lock"); Notifications Information (int id, n); Log D. (Timer activity. TAG, "notified!"); + Try {+ Thread.sleep (1000); +} (Interrupted predefined E) {e.printStackTrace (); } + Log D. (Timer activity. TAG, "lock was released"); + Wl.release ();  

... and this problem has not been seen since I added it, but this may be a coincidence, and it is obviously an ugly hack which I actually Try to avoid leaving the project (currently only one person uses it, which I know).

It has been seen on two Nexus One running two android 2.2 (fro). It was not seen on 2.1, but that version was not used much, and G1 was not seen on 1.6, where it was used for a few months. It has been viewed from all times of the day, with sounds from SD card and internal memory on Android 2.2.1 by January 2011 on the SD card from the ringtones This is happening as well. I have searched for anything, no benefit

It appears but it seems that it can be an OS bug when the SD card is tone, then I am not separating anything; There is a URI so far in relation to this app.

This works for me:

notification .defaults = information. DEFAULT_SOUND | Notification DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS;

I do not see it in your code.

Hope that works for you too.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -