Kodi Development  20.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 /*---AUTO_GEN_PARSE<$$CORE_SYSTEM_NAME:android>---*/
10 
11 #pragma once
12 
13 #include "../../AddonBase.h"
14 #include "../../c-api/platform/android/system.h"
15 
16 #ifdef __cplusplus
17 namespace kodi
18 {
19 namespace platform
20 {
21 
22 //==============================================================================
45 class ATTRIBUTE_HIDDEN CInterfaceAndroidSystem
46 {
47 public:
49  : m_interface(static_cast<AddonToKodiFuncTable_android_system*>(
50  GetInterface(INTERFACE_ANDROID_SYSTEM_NAME, INTERFACE_ANDROID_SYSTEM_VERSION)))
51  {
52  }
53 
54  //============================================================================
63  inline void* GetJNIEnv()
64  {
65  if (m_interface)
66  return m_interface->get_jni_env();
67 
68  return nullptr;
69  }
70  //----------------------------------------------------------------------------
71 
72  //============================================================================
78  inline int GetSDKVersion()
79  {
80  if (m_interface)
81  return m_interface->get_sdk_version();
82 
83  return 0;
84  }
85  //----------------------------------------------------------------------------
86 
87  //============================================================================
93  inline std::string GetClassName()
94  {
95  if (m_interface)
96  return m_interface->get_class_name();
97 
98  return std::string();
99  }
100  //----------------------------------------------------------------------------
101 
102 private:
104 };
105 //------------------------------------------------------------------------------
106 
107 } /* namespace platform */
108 } /* namespace kodi */
109 #endif /* __cplusplus */
std::string GetClassName()
Request the android main class name e.g. org.xbmc.kodi.
Definition: System.h:93
void * GetJNIEnv()
Request an JNI env pointer for the calling thread.
Definition: System.h:63
int GetSDKVersion()
Request the android sdk version to e.g. initialize JNIBase.
Definition: System.h:78
void * GetInterface(const std::string &name, const std::string &version)
Returns a function table to a named interface.
Definition: AddonBase.h:1328