Commit 5a6938e8 authored by camilo higuita's avatar camilo higuita

polish works for newest android sdks

parent aba213ff
......@@ -21,42 +21,22 @@
#include "3rdparty/mauikit/src/mauikit.h"
#endif
//#if defined (Q_OS_ANDROID)
//#include <QtAndroid>
//bool requestAndroidPermissions(){
// //Request requiered permissions at runtime
// const QVector<QString> permissions({"android.permission.WRITE_EXTERNAL_STORAGE"});
// for(const QString &permission : permissions){
// auto result = QtAndroid::checkPermission(permission);
// if(result == QtAndroid::PermissionResult::Denied){
// auto resultHash = QtAndroid::requestPermissionsSync(QStringList({permission}));
// if(resultHash[permission] == QtAndroid::PermissionResult::Denied)
// return false;
// }
// }
// return true;
//}
//#endif
#ifdef Q_OS_ANDROID
#include <QtAndroid>
// Taken from https://bugreports.qt.io/browse/QTBUG-50759
bool check_permission() {
bool check_permission() //STILL NOT MAKING SDCARD WRITABLE
{
qDebug() << "CHECHKIGN PERMISSIONS";
QtAndroid::PermissionResult r = QtAndroid::checkPermission("android.permission.WRITE_EXTERNAL_STORAGE");
if(r == QtAndroid::PermissionResult::Denied) {
if(r == QtAndroid::PermissionResult::Denied)
{
QtAndroid::requestPermissionsSync( QStringList() << "android.permission.WRITE_EXTERNAL_STORAGE" );
r = QtAndroid::checkPermission("android.permission.WRITE_EXTERNAL_STORAGE");
if(r == QtAndroid::PermissionResult::Denied) {
if(r == QtAndroid::PermissionResult::Denied)
{
qDebug() << "Permission denied";
return false;
}
......@@ -77,14 +57,10 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
#endif
//#if defined (Q_OS_ANDROID)
// if(!requestAndroidPermissions())
// return -1;
//#endif
#if defined (Q_OS_ANDROID)
if (!check_permission())
return -1;
#endif
app.setApplicationName(INX::app);
app.setApplicationVersion(INX::version);
......
......@@ -172,7 +172,5 @@ Maui.ApplicationWindow
{
if(isAndroid)
Maui.Android.statusbarColor(Kirigami.Theme.backgroundColor, true)
// Maui.Android.checkAndroidStoragePermissions()
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment