getContentResolver()。insert(...,...);为通知铃声返回NULL

时间:2012-01-05 06:26:34

标签: android

getContentResolver()。insert(...,...);当setRingtone函数被调用onBootCompleted设备时,返回通知铃声的NULL,否则它工作正常:

这里是setRingTone方法代码:

File file = new File(path, filename);
ContentValues values = new ContentValues();
values.put(MediaStore.MediaColumns.DATA, file.getAbsolutePath());
values.put(MediaStore.MediaColumns.TITLE, "Tone");
values.put(MediaStore.MediaColumns.MIME_TYPE, "audio/ogg");
values.put(MediaStore.Audio.Media.ARTIST, "test");
values.put(MediaStore.Audio.Media.IS_RINGTONE, false);
values.put(MediaStore.Audio.Media.IS_NOTIFICATION, true);
values.put(MediaStore.Audio.Media.IS_ALARM, false);
values.put(MediaStore.Audio.Media.IS_MUSIC, false);

Uri u = getContentResolver().insert(
    MediaStore.Audio.Media.getContentUriForPath(file.getAbsolutePath()), values);

0 个答案:

没有答案