How to set the default ringtones for Android calls and how to set the default ringtones for voice calls

Source: Internet
Author: User
How to set the default ringtones for Android calls and how to set the default ringtones for voice calls

1. Implementation of the default setting of Android incoming call ringtones andoird the default setting of incoming call ringtones is to modify the value of build/target/product/'s ro.config.ringtoneas ro.config.ringtone?backroad.ogg, this music file must be in framework/base/data/sounds/android. add music files to MK. Framework/base/Media/Java/Android/Media/mediascanner. during class initialization in Java, the variable mdefaultringtonefilename = systemproperties for the name of the default ringtone will be set. get (default_ringtone_property_prefix + setting. system. ringtone); The mediascanner class will search for music files, which must be inserted into the database. During the search process, check whether it is the same as the set default ringtone. If it is the same, set it to the default ringtone .} Else if (ringtones & mwasemptypriortoscan &&! Mdefaultringtoneset ){
If (textutils. isempty (mdefaultringtonefilename) |
Doespathhavefilename (entry. mpath, mdefaultringtonefilename )){
Setsettingifnotset (settings. system. ringtone, tableuri, rowid );
Setprofilesettings (audioprofilemanager. type_ringtone, tableuri, rowid );
Mdefaultringtoneset = true;
When you set the voice to the connected voice, you must first add ro.config.videocall1_bentleydubs.ogg in Add two new member variables to the framework/base/Media/Java/Android/Media/mediascanner. Java class.

Private Boolean mdefavidevideocallset;

Private string mdefaultvideocallfilename; Add the following code in the setdefaultringtonefilenames () method to initialize the name of the default ringtone File

Mdefaultvideocallfilename = systemproperties. Get (default_ringtone_property_prefix
+ Settings. system. video_call );

Add the following code to the endfile () method to set the default ringtone for a voice call} else if (ringtones & mwasemptypriortoscan &&! Mdefaultvideocallset ){
If (textutils. isempty (mdefavidevideocallfilename) |
Doespathhavefilename (entry. mpath, mdefavidevideocallfilename )){
Setsettingifnotset (settings. system. video_call, tableuri, rowid );
Setprofilesettings (audioprofilemanager. type_video_call, tableuri, rowid );
Mdefaultvideocallset = true;
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.