Functions for Android.
More...
#include <geogram/basic/common.h>
#include <geogram/basic/numeric.h>
#include <geogram/basic/argused.h>
#include <android/log.h>
#include <string>
Go to the source code of this file.
|
| GEO |
| Global Vorpaline namespace.
|
|
Functions for Android.
Definition in file android_utils.h.
◆ debug_log() [1/2]
void GEO::AndroidUtils::debug_log |
( |
const char * |
str | ) |
|
|
inline |
Displays a message in the android log in Debug mode, ignored in Release mode.
The message can be displayed using 'adb logcat | grep GEOGRAM'
- Parameters
-
[in] | str | the message to be displayed |
Definition at line 125 of file android_utils.h.
◆ debug_log() [2/2]
void GEO::AndroidUtils::debug_log |
( |
const std::string & |
str | ) |
|
|
inline |
Displays a message in the android log in Debug mode, ignored in Release mode.
The message can be displayed using 'adb logcat | grep GEOGRAM'
- Parameters
-
[in] | str | the message to be displayed |
Definition at line 141 of file android_utils.h.
◆ debug_show_event()
void GEO::AndroidUtils::debug_show_event |
( |
AInputEvent * |
event | ) |
|
Displays an android event in the android log in Debug mode, ignored in release mode.
The message can be displayed using 'adb logcat | grep GEOGRAM'
- Parameters
-
[in] | event | the event to be displayed |
◆ has_permission()
bool GEO::AndroidUtils::has_permission |
( |
android_app * |
app, |
|
|
const char * |
perm |
|
) |
| |
Tests whether a permission is granted.
- Parameters
-
[in] | app | a pointer to the android app. |
[in] | perm | the name of the permission, e.g., "READ_EXTERNAL_STORAGE", "WRITE_EXTERNAL_STORAGE". |
- Return values
-
true | if the permission is granted. |
false | otherwise. |
- Note
- Requires Android API level 23 (Marshmallow, May 2015)
◆ hide_soft_keyboard()
void GEO::AndroidUtils::hide_soft_keyboard |
( |
android_app * |
app | ) |
|
Hides the software keyboard on the phone.
- Parameters
-
[in] | app | a pointer to the android app. |
◆ keycode_to_unicode()
Converts a keycode to a Unicode character.
- Parameters
-
[in] | app | a pointer to the android app. |
[in] | deviceId,keyCode,metaState | obtained from the InputEvent. |
◆ request_permissions()
void GEO::AndroidUtils::request_permissions |
( |
android_app * |
app, |
|
|
int |
nb_perms, |
|
|
const char ** |
perms |
|
) |
| |
Request permissions.
This opens the system dialog that lets the user grant (or deny) the permission.
- Parameters
-
[in] | app | a pointer to the android app. |
[in] | nb_perms | number of requested permissions. |
[in] | perms | the names of the permission, e.g., "READ_EXTERNAL_STORAGE", "WRITE_EXTERNAL_STORAGE". |
- Note
- Requires Android API level 23 (Marshmallow, May 2015)
◆ show_soft_keyboard()
void GEO::AndroidUtils::show_soft_keyboard |
( |
android_app * |
app | ) |
|
Shows the software keyboard on the phone.
- Parameters
-
[in] | app | a pointer to the android app. |
◆ temp_folder()
std::string GEO::AndroidUtils::temp_folder |
( |
android_app * |
app | ) |
|
Gets the path for temporary file.
- Parameters
-
[in] | app | a pointer to the android app. |
- Returns
- a std::string with the path where to write temporary files.