Kodi Development 19.0
for Binary and Script based Add-Ons
System.h
1/*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include "../../AddonBase.h"
12#include "../../c-api/platform/android/system.h"
13
14#ifdef __cplusplus
15namespace kodi
16{
17namespace platform
18{
19
20//==============================================================================
43class ATTRIBUTE_HIDDEN CInterfaceAndroidSystem
44{
45public:
47 : m_interface(static_cast<AddonToKodiFuncTable_android_system*>(
48 GetInterface(INTERFACE_ANDROID_SYSTEM_NAME, INTERFACE_ANDROID_SYSTEM_VERSION))){};
49
50 //============================================================================
59 inline void* GetJNIEnv()
60 {
61 if (m_interface)
62 return m_interface->get_jni_env();
63
64 return nullptr;
65 }
66 //----------------------------------------------------------------------------
67
68 //============================================================================
74 inline int GetSDKVersion()
75 {
76 if (m_interface)
77 return m_interface->get_sdk_version();
78
79 return 0;
80 }
81 //----------------------------------------------------------------------------
82
83 //============================================================================
89 inline std::string GetClassName()
90 {
91 if (m_interface)
92 return m_interface->get_class_name();
93
94 return std::string();
95 }
96 //----------------------------------------------------------------------------
97
98private:
100};
101//------------------------------------------------------------------------------
102
103} /* namespace platform */
104} /* namespace kodi */
105#endif /* __cplusplus */
std::string GetClassName()
Request the android main class name e.g. org.xbmc.kodi.
Definition: System.h:89
int GetSDKVersion()
Request the android sdk version to e.g. initialize JNIBase.
Definition: System.h:74
void * GetJNIEnv()
Request an JNI env pointer for the calling thread.
Definition: System.h:59
void * GetInterface(const std::string &name, const std::string &version)
Returns a function table to a named interface.
Definition: AddonBase.h:1328