Problem is that I can't rename file, even create folder. Nothing helps. All rights granted. Read-write in manifest existing. What is happening - IDK
Checked rights with this code:
bool chch;
auto result = QtAndroid::checkPermission(QString("android.permission.WRITE_EXTERNAL_STORAGE"));
if (result == QtAndroid::PermissionResult::Denied) {
QtAndroid::PermissionResultMap resultHash = QtAndroid::requestPermissionsSync(QStringList({"android.permission.WRITE_EXTERNAL_STORAGE"}));
if (resultHash["android.permission.WRITE_EXTERNAL_STORAGE"] == QtAndroid::PermissionResult::Denied)
chch = false;
else {
/* Here is Your method to upload to storage * /
chch = true;
}
}
else {
/* Here is Your method to upload to storage * /
chch = true;
}
Result is - TRUE;
So next tried code from this topic - Qt Android Directories
bool result;
QDir dir("/storage/emulated/0");
qDebug() << dir;
result = dir.mkdir("cache");
qDebug() << "mkdir(\"cache\") success: " << result;
QFile m_file(dir.path() + "/cache/cache.txt");
result = m_file.open(QFile::WriteOnly);
qDebug() << "open() success: " << result;
m_file.close();
result = m_file.rename(dir.path() + "/cache/cache.zip");
qDebug() << "rename() success: " << result;
Output:
D libNote_armeabi-v7a.so: mkdir("cache") success: false
D libNote_armeabi-v7a.so: open() success: false
D libNote_armeabi-v7a.so: rename() success: false
When I directly with opendialog taking path, there's this:
content:/com.android.externalstorage.documents/tree/primary%3A
Force switching it to /storage/emulated/0 doesn't help.
In both cases result is FALSE, so I can't create folder, can't access to the files and can't rename them.
What is the problem?
There's no other code. Just simply tried with 1 button change filename to implement it in main app later.
Pls help, trying whole day.