tagtime / TagTime

Stochastic Time Tracking for Space Cadets
http://tagti.me
Other
367 stars 51 forks source link

Notification sounds while on silent #31

Closed jeffkaufman closed 10 years ago

jeffkaufman commented 10 years ago

I convinced a friend to start using TagTime on their Motorola Razr M running jellybean. Whenever it pinged them it also played a sound. The phone was on silent and in the preferences they selected "silent" for the notification sound, but it still made noise.

I built TagTime from source, installed it on their phone, and saw that the problem persisted. I captured a log for running a debug ping:

10-26 20:01:56.284 14891 14891 I PingsDbAdapter: createPing()
10-26 20:01:56.344 14891 14891 I PingsDbAdapter: updateTaggings() improved
10-26 20:01:56.354 14891 14891 I PingsDbAdapter: getTID()
10-26 20:01:56.354 14891 14891 I PingsDbAdapter: queried for tag=
10-26 20:01:56.384   702   712 D PowerManagerService: acquireWakeLock flags=0x1 tag=RingtonePlayer
10-26 20:01:56.394   702   712 D PowerManagerService: acquireWakeLock flags=0x1 tag=*vibrator*
10-26 20:01:56.394   856 15276 E MediaPlayer: Uri is  content://settings/system/notification_sound
10-26 20:01:56.404 12745 12756 V MediaProvider: openFile: uri=content://media/internal/audio/media/40
10-26 20:01:56.404 12745 12756 V MediaProvider: query: uri=content://media/internal/audio/media/40, selection=null

The relevant code seemed to be:

PingService.java:
  String sound_uri = mPrefs.getString("pingRingtonePref", "DEFAULT_RINGTONE_URI");
  if (!sound_uri.equals("")) {
    note.sound = Uri.parse(sound_uri);
  } else {
    note.defaults |= Notification.DEFAULT_SOUND;
  }

To debug it I added Log.i(TAG,"PingService: sound_uri=" + sound_uri); right after mPrefs.getString(). I built and installed it on the phone, and observed:

10-26 20:07:21.174 15654 15654 I PingService: PingService: sound_uri=DEFAULT_RINGTONE_URI

and it didn't make the sound on ping anymore. I uninstalled my custom TagTime, installed from the play store, and still pings are vibrate-only now.

The fix persists even if I do "delete all data".

I don't know how this fixed it or why, but it's not a problem any more.

saranli commented 10 years ago

This should be fixed now in the version I just published on Google Play. The "else" part in the code snippet above was not supposed to enable the default alarm sound. Let me know if the problem persists, I tested mainly on Android 2.3.7.