3 * Copyright (C) 2013 Team XBMC
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with XBMC; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
23 #include "BroadcastReceiver.h"
25 struct ANativeActivity;
27 class CJNIPackageManager;
28 class CJNIBroadcastReceiver;
29 class CJNIIntentFilter;
30 class CJNIClassLoader;
31 class CJNIApplicationInfo;
33 class CJNIContentResolver;
38 static CJNIPackageManager GetPackageManager();
39 static void startActivity(const CJNIIntent &intent);
40 static jni::jhobject getSystemService(const std::string &service);
41 static int checkCallingOrSelfPermission(const std::string &permission);
42 static CJNIIntent registerReceiver(const CJNIBroadcastReceiver &receiver, const CJNIIntentFilter &filter);
43 static CJNIIntent registerReceiver(const CJNIIntentFilter &filter);
44 static void unregisterReceiver(const CJNIBroadcastReceiver &receiver);
45 static CJNIIntent sendBroadcast(const CJNIIntent &intent);
46 static CJNIIntent getIntent();
47 static CJNIClassLoader getClassLoader();
48 static CJNIApplicationInfo getApplicationInfo();
49 static std::string getPackageResourcePath();
50 static CJNIFile getCacheDir();
51 static CJNIFile getDir(const std::string &path, int mode);
52 static CJNIFile getExternalFilesDir(const std::string &path);
53 static CJNIContentResolver getContentResolver();
54 static CJNIContext* GetAppInstance() { return m_appInstance; };
55 static void _onNewIntent(JNIEnv *env, jobject context, jobject intent);
58 CJNIContext(const ANativeActivity *nativeActivity);
61 virtual void onNewIntent(CJNIIntent intent)=0;
66 void PopulateStaticFields();
67 void operator=(CJNIContext const&){};
68 static jni::jhobject m_context;
69 static CJNIContext *m_appInstance;