2011年5月17日火曜日

AndroidStudyMemo=Working with Ringtones

Much like wallpapers, ringtones are a popular way to personalize a handset.The Android

SDK provides a variety of ways to manage ringtones through the RingtoneManager object.

You can assign the recorded audio from the previous example as the current ringtone

with the following static method call:

              RingtoneManager.setActualDefaultRingtoneUri(

                            getApplicationContext(),

                            RingtoneManager.TYPE_RINGTONE, audioUri);

The type can also be TYPE_ALARM or TYPE_NOTIFICATION to configure sounds of other

system events that use audio tones.To successfully perform this operation, though, the application

must have the android.permission.WRITE_SETTINGS permission set in the

AndroidManifest.xml file.You can also query the default ringtone with a call to the

static RingtoneManager.getActualDefaultRingtoneUri() method.You can use the resulting

Uri to play the ringtone, which might be useful within applications that want to

alert the user.

0 件のコメント:

コメントを投稿