-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
153 changed files
with
3,729 additions
and
2,428 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/**************************************************************************** | ||
* | ||
* Copyright (C) 2018 Pinecone Inc. All rights reserved. | ||
* | ||
* QGroundControl is licensed according to the terms in the file | ||
* COPYING.md in the root of the source code directory. | ||
* | ||
****************************************************************************/ | ||
|
||
#include <QtAndroidExtras/QtAndroidExtras> | ||
#include <QtAndroidExtras/QAndroidJniObject> | ||
#include "QGCApplication.h" | ||
#include "AndroidInterface.h" | ||
#include <QAndroidJniObject> | ||
#include <QtAndroid> | ||
|
||
QString AndroidInterface::getSDCardPath() | ||
{ | ||
QAndroidJniObject value = QAndroidJniObject::callStaticObjectMethod("org/mavlink/qgroundcontrol/QGCActivity", "getSDCardPath", | ||
"()Ljava/lang/String;"); | ||
QString sdCardPath = value.toString(); | ||
|
||
QString readPermission("android.permission.READ_EXTERNAL_STORAGE"); | ||
QString writePermission("android.permission.WRITE_EXTERNAL_STORAGE"); | ||
|
||
if (QtAndroid::checkPermission(readPermission) == QtAndroid::PermissionResult::Denied || | ||
QtAndroid::checkPermission(writePermission) == QtAndroid::PermissionResult::Denied) { | ||
QtAndroid::PermissionResultMap resultHash = QtAndroid::requestPermissionsSync(QStringList({ readPermission, writePermission })); | ||
if (resultHash[readPermission] == QtAndroid::PermissionResult::Denied || | ||
resultHash[writePermission] == QtAndroid::PermissionResult::Denied) { | ||
return QString(); | ||
} | ||
} | ||
|
||
return sdCardPath; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/**************************************************************************** | ||
* | ||
* Copyright (C) 2018 Pinecone Inc. All rights reserved. | ||
* | ||
* QGroundControl is licensed according to the terms in the file | ||
* COPYING.md in the root of the source code directory. | ||
* | ||
****************************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include <QObject> | ||
#include <jni.h> | ||
#include <QtCore/private/qjni_p.h> | ||
#include <QtCore/private/qjnihelpers_p.h> | ||
|
||
class AndroidInterface | ||
{ | ||
public: | ||
static QString getSDCardPath(); | ||
}; |
Oops, something went wrong.