insert - Efficient way for adding music to ringtone on Android -
I have a problem connecting music to Android ringtones (stored in SDCD) I have here to include it The code is:
ContentValues value = new content value (); Values.put (MediaStore.Media Column.DATA, filePath); Values.put (MediaStore.Media Column. Title, song title); Values.put (MediaStore.MediaColumns.SIZE, file.length ()); Values.put (MediaStore.MediaColumn.MIME_TYPE, "audio /" + fileType); Values.put (MediaStore.Audio.Media.ARTIST, singing name); Values.put (MediaStore.Audio.Media.DURATION, Duration); Values.put (MediaStore.Audio.Media.IS_RINGTONE, true); Values.put (MediaStore.Audio.Media.IS_NOTIFICATION, Truth); Values.put (MediaStore.Audio.Media.IS_ALARM, true); Values.put (MediaStore.Audio.Media.IS_MUSIC, true); / * Deleted bug here * / Uri Yuri = MediaStore.audio.media.vsententurphorpath (filepath); URI newUri = context.getContentResolver (). Insert (Yuri, Mann); If (Earrington) ringtone manager.SetUtualDial RingingTurn URI (Reference, RingtoneManager.TYPE_RINGTONE, New Age); If (ISMS) ringtone manager.SetAutualColedFolteringTown URI (Reference, RingtoneManager.Technology, NewURI);
After adding the ringtone 1 to Android settings, I add the ringtone to the settings again and I have 2 ringtone 1 in the ringtone list.
The strange thing is that when I am putting a ringtone for information, it will only be displayed in the information list. But if I remove the ringtone, it will be removed on both the phone ringtone list and the notification ringtone. The list which I did not set after removing the ringtone will be "unknown ringtone".
So I want to find a way to check if a ringtone already exists in the settings or not. Secondly, I want to find a way to get the ringtone Yuri which was added to the setting.
If you do not get the question, please send me a comment here. Sorry for my poor english Thanks a lot.
To do something like this, if you already have URI
that < Code> ringtone manager usage
string [] column = {MediaStore.MediaColumns..TITLE, MediaStore.MediaColumns._ID}; String Selection = Mediastore Audio. Media. Data + "=?"; String selection form [] = {k.getAbsolutePath ()}; Cursor cursor = context.getContentResolver (). Query (Yuri, Column, Selection, Selection, Empty, Empty);
This will bring you if you have already added and URI
to be used in setActualDefaultRingtoneUri ()
Comments
Post a Comment