Contact ringtone

Post your questions and help other users.

Moderator: Martin

Post Reply
bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Contact ringtone

Post by bogdyro » 23 Aug 2015 05:05

Hello.
Is it possible to edit a contacts custom ringtone preferably without any user interaction by using send broadcast or start activity? Thanks

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Contact ringtone

Post by Martin » 23 Aug 2015 09:21

Hi,

There's no easy way to my knowledge. You could probably update the contacts database with command content but this could become complicated.
You could also try to set the custom ringtone for a contact and replace the sound file when you want to play another ringtone.

Regards,
Martin

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: Contact ringtone

Post by bogdyro » 23 Aug 2015 14:28

Hi. Thanks for the response. I was already using the second method(replacing a file that I selected for that contact). I'm also doing something else now which works well:silencing the ringtone when a call comes in from some person and playing back a random song on the 'music' stream. It seems to start the play back sooner than if I let the ringtone play by itslef,don't know why that is.
I'm also interested in the 'content' method. Seems cleaner. Could you give me an example please?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Contact ringtone

Post by Martin » 24 Aug 2015 19:06

Hi,

Sorry, I have no good example for this. When you connect your device to a PC you can get a description of the command with adb shell content. It includes some examples for listing and modifying system settings.

Listing the contacts could look like this:

Code: Select all

content query --uri content://com.android.contacts/contacts --projection _id:display_name:custom_ringtone
changing the ringtone of a specific contact could look like this:

Code: Select all

content update --uri content://com.android.contacts/contacts --bind custom_ringtone:s:content://media/internal/audio/media/123 --where "_id=321"
The contacts content provider is quite complicated to work with. Here's the entry point to the documentation: http://developer.android.com/guide/topi ... vider.html

Regards,
Martin

Post Reply