Android Question Possible bug in RingtoneManager?

lte5000

Member
Licensed User
Longtime User
B4X:
rm.ShowRingtonePicker("rm", rm.TYPE_NOTIFICATION, True, "")
When running this code and selecting the default ringtone it returns: "content://settings/system/ringtone".
It should return: "content://settings/system/notification_sound".

When running the AHPreferenceActivity library on the same phone it will return: "content://settings/system/notification_sound", as it should.
For example, the code below works correctly:
B4X:
cat1.AddRingtone("ring1", "Choose Alert Sound", "", "", "", cat1.RT_NOTIFICATION)

I found a link where someone had this same problem, and it also has a fix described: http://stackoverflow.com/questions/...sue-default-tone-with-notifications-and-alarm

Thanks,
Kendall
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I've tried this code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   rm.ShowRingtonePicker("rm", rm.TYPE_NOTIFICATION, True, "")
End Sub

Sub rm_PickerResult (Success As Boolean, Uri As String)
   Log(Uri)
   Dim mp As MediaPlayer
   mp.Initialize
   mp.Load(rm.GetContentDir, Uri)
   mp.Play
End Sub
It correctly plays the default ringtone.
 
Upvote 0

lte5000

Member
Licensed User
Longtime User
Erel,

Yes, your code plays the default ringtone on my phone, but shouldn't it instead play the default notification sound, or am I mistaken?

I uploaded an example to demonstrate the difference in behavior between the ringtone picker built into AHPreferenceActivity (which I believe is correct) and the RingToneManager picker (which I think is wrong).

Thanks again for your help!
 

Attachments

  • test.zip
    392.9 KB · Views: 326
  • test.png
    test.png
    46.9 KB · Views: 255
Upvote 0

lte5000

Member
Licensed User
Longtime User
Please use File - Export as zip when uploading projects.

OK, I will use the export as zip next time. Should I re-upload the project for you?

When I ran the code I posted it played the same sound when I chose it from the list and later when PickerResult event was raised. Do you get different results?

I get the default ringtone both when I chose it, and when the event is raised.
 
Upvote 0
Top