Judging by the need to set ringtones in the file system exists in the source RingtoneManager.java where getActualDefaultRingtoneUri (Context context, int type) has increased by the following code:
File file = new File (file_path) // file_path SD is known to exist in the file, such as: "/ mnt / sdcard / recordings / test.mp3"
if (file.exists ())
{
return true;
}
else
{
return false;
}
If the point when file_path SD card file This code always returns false (file does exist, and the path and name are not wrong), I do not know why, please dance. If file_path point system memory when files are normal.
Reply:
His top, under the guidance of the great God who ah

Reply:
Are you sure you add the right to limit access to it?
Reply:
The file_path = Environment.getExternalStorageDirectory () + "/" + "recordings / test.mp3"; I feel wrong path
Reply:
is the code in the source framework plus access Riga how ah? Do not add it!
Reply:
Use the same method you provided is still return false;
Reply:
File is on the sd card or in the built-in storage?
Reply:
on the SD card
Reply:
Check the path is not an error
Reply:
Lay the log look getExternalStorageDirectory path
Also must remind you at: file itself may be empty, so the best judge under the former judge file.exists file is empty
And these things are not in the system ringtones on sd card, even though you do not know why this is generally translated into system / under the media's
Reply:
I was set up on the SD card recordings / test.mp3 file as ringtones, log output file_path is: "/ mnt / sdcard / recordings / test.mp3", which should issue it, is calling file.exists when all returns false (); But I standalone application apk call file.exists () returns is normal, and if the file exists returns true, it does not exist return false; but I will add the same piece of code in the source RingtoneManager.java where getActualDefaultRingtoneUri (Context context, int type) in It returns an exception, and only in the SD file returns an exception, the phone memory in the file is normal. Guaizai?
Reply:
Try to add a try catch, this path is on the T card, it is estimated java compiler will add about another processing
Reply:
So I think it is caused by mk file local_certificate, if written userId seemingly
not access sd cardYou can continue to look at Baidu
Reply:
Seemingly system privileges can not access the SD card
(not sure if 4.0) after the android 4.0So the framework should be applied to access fails, you can write a simple test apk try is not true of returns
Reply:
Test apk return is normal
Reply:
file-path: "/mnt/sdcard/recordings/test.mp3" into /sdcard/recordings/test.mp3
Reply:
Android version is that you change the framework? Because the system is estimated to be restricted access to sdcard
Reply:
And you encounter the same problem. I also do not understand.
Reply:
I also encountered the same problem, to add permissions
& Lt; uses-permission android: name = "android.permission.WRITE_EXTERNAL_STORAGE" / & gt;
Reply:
Why this issue is resolved
No comments:
Post a Comment