├── .gitignore ├── LICENSE ├── README.md ├── manual.txt ├── proj.android ├── .classpath ├── .cproject ├── .externalToolBuilders │ └── org.eclipse.cdt.managedbuilder.core.genmakebuilder.launch ├── .project ├── AndroidManifest.xml ├── build_native.sh ├── ic_launcher-web.png ├── jni │ ├── AdTracking.cpp │ ├── AdTracking.h │ ├── Ads.cpp │ ├── Ads.h │ ├── Analytics.cpp │ ├── Analytics.h │ ├── Android.mk │ ├── Application.mk │ ├── Crash.cpp │ ├── Crash.h │ ├── PluginChannel.cpp │ ├── PluginChannel.h │ ├── Push.cpp │ ├── Push.h │ ├── REC.cpp │ ├── REC.h │ ├── Share.cpp │ ├── Share.h │ ├── Social.cpp │ ├── Social.h │ └── main.cpp ├── libs │ ├── armeabi-v7a │ │ └── libgame.so │ └── armeabi │ │ └── libgame.so ├── lint.xml ├── proguard-project.txt ├── project.properties ├── protocols │ ├── android │ │ ├── Android.mk │ │ ├── PluginJavaData.h │ │ ├── PluginJniHelper.h │ │ ├── PluginJniMacros.h │ │ ├── PluginUtils.h │ │ ├── Statistics.h │ │ ├── lib │ │ │ ├── arm64-v8a │ │ │ │ └── libPluginProtocolStatic.a │ │ │ ├── armeabi-v7a │ │ │ │ └── libPluginProtocolStatic.a │ │ │ ├── armeabi │ │ │ │ └── libPluginProtocolStatic.a │ │ │ └── x86 │ │ │ │ └── libPluginProtocolStatic.a │ │ └── libPluginProtocol.jar │ └── include │ │ ├── AgentManager.h │ │ ├── JSBRelation.h │ │ ├── PluginFactory.h │ │ ├── PluginManager.h │ │ ├── PluginParam.h │ │ ├── PluginProtocol.h │ │ ├── ProtocolAdTracking.h │ │ ├── ProtocolAds.h │ │ ├── ProtocolAnalytics.h │ │ ├── ProtocolCrash.h │ │ ├── ProtocolCustom.h │ │ ├── ProtocolIAP.h │ │ ├── ProtocolPush.h │ │ ├── ProtocolREC.h │ │ ├── ProtocolShare.h │ │ ├── ProtocolSocial.h │ │ └── ProtocolUser.h ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-ldpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── drawable │ │ ├── plugin_btn_close.png │ │ └── plugin_ui_ad.png │ ├── layout │ │ ├── activity_ads.xml │ │ ├── activity_first.xml │ │ ├── activity_iap.xml │ │ ├── activity_main.xml │ │ ├── activity_push.xml │ │ ├── activity_share.xml │ │ ├── activity_social.xml │ │ ├── activity_user.xml │ │ ├── plugin_ads.xml │ │ └── plugin_login.xml │ ├── values-en │ │ └── plugin_string.xml │ └── values │ │ ├── channel.xml │ │ ├── plugin_string.xml │ │ ├── strings.xml │ │ └── styles.xml └── src │ └── com │ └── anysdk │ └── sample │ ├── Controller.java │ ├── MainActivity.java │ └── wrapper.java └── proj.ios ├── protocols ├── include │ ├── AdsUtil.h │ ├── AdsWrapper.h │ ├── AgentManager.h │ ├── AnalyticsWrapper.h │ ├── CocosRuntimeDelegate.h │ ├── CustomWrapper.h │ ├── IAPWrapper.h │ ├── InterfaceAdTracking.h │ ├── InterfaceAds.h │ ├── InterfaceAnalytics.h │ ├── InterfaceCrash.h │ ├── InterfaceCustom.h │ ├── InterfaceIAP.h │ ├── InterfacePush.h │ ├── InterfaceREC.h │ ├── InterfaceShare.h │ ├── InterfaceSocial.h │ ├── InterfaceUser.h │ ├── JSBRelation.h │ ├── JsonParser.h │ ├── PluginApplicationDelegate.h │ ├── PluginFactory.h │ ├── PluginHelper.h │ ├── PluginManager.h │ ├── PluginParam.h │ ├── PluginProtocol.h │ ├── PluginWrapper.h │ ├── ProtocolAdTracking.h │ ├── ProtocolAds.h │ ├── ProtocolAnalytics.h │ ├── ProtocolCrash.h │ ├── ProtocolCustom.h │ ├── ProtocolIAP.h │ ├── ProtocolPush.h │ ├── ProtocolREC.h │ ├── ProtocolShare.h │ ├── ProtocolSocial.h │ ├── ProtocolUser.h │ ├── PushWrapper.h │ ├── RECWrapper.h │ ├── SdkHttpListener.h │ ├── ShareWrapper.h │ ├── SocialWrapper.h │ ├── UserWrapper.h │ └── Wrapper.h └── libPluginProtocol.a └── sample ├── res └── channel.plist ├── sample.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── xcshareddata │ └── sample.xccheckout └── sample ├── AdTracking.h ├── AdTracking.mm ├── Ads.h ├── Ads.mm ├── Analytics.h ├── Analytics.mm ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj ├── LaunchScreen.xib └── Main.storyboard ├── Crash.h ├── Crash.mm ├── Images.xcassets └── AppIcon.appiconset │ └── Contents.json ├── Info.plist ├── PartViews.h ├── PartViews.mm ├── PluginChannel.h ├── PluginChannel.mm ├── Push.h ├── Push.mm ├── REC.h ├── REC.mm ├── Share.h ├── Share.mm ├── Social.h ├── Social.mm ├── Toast.h ├── Toast.m ├── ViewController.h ├── ViewController.mm ├── main.m └── view ├── BButton.h ├── BButton.m ├── NSString+FontAwesome.h ├── NSString+FontAwesome.m ├── UIColor+BButton.h └── UIColor+BButton.m /.gitignore: -------------------------------------------------------------------------------- 1 | #ignore thumbnails created by windows 2 | Thumbs.db 3 | #Ignore files build by Visual Studio 4 | *.obj 5 | *.exe 6 | *.pdb 7 | *.aps 8 | *.vcproj.*.user 9 | *.vspscc 10 | *_i.c 11 | *.i 12 | *.icf 13 | *_p.c 14 | *.ncb 15 | *.suo 16 | *.tlb 17 | *.tlh 18 | *.bak 19 | *.cache 20 | *.ilk 21 | *.log 22 | [Bb]in 23 | [Dd]ebug*/ 24 | *.sbr 25 | *.sdf 26 | obj/ 27 | [Rr]elease*/ 28 | _ReSharper*/ 29 | [Tt]est[Rr]esult* 30 | ipch/ 31 | *.opensdf 32 | 33 | # Ignore files build by ndk and eclipse 34 | #*.a 35 | *.settings 36 | environment.sh 37 | #libs/ 38 | bin/ 39 | obj/ 40 | gen/ 41 | #.classpath 42 | #.project 43 | #.project.properties 44 | #.cproject 45 | local.properties 46 | 47 | # Ignore files build by linux 48 | *.o 49 | 50 | # Ignore python compiled files 51 | 52 | # Ignore files build by airplay 53 | build_*_xcode/ 54 | 55 | # Ignore files build by xcode 56 | *.mode*v* 57 | *.pbxuser 58 | *.xcbkptlist 59 | *.xcscheme 60 | *.xcworkspacedata 61 | *.xcuserstate 62 | xcschememanagement.plist 63 | build/ 64 | .DS_Store 65 | xcuserdata/ 66 | 67 | # Ignore files built by bada 68 | .Simulator-Debug/ 69 | .Target-Debug/ 70 | .Target-Release/ 71 | 72 | # Ignore files built by blackberry 73 | Simulator/ 74 | Device-Debug/ 75 | Device-Release/ 76 | 77 | # Ignore vim swaps 78 | *.swp 79 | 80 | # Ignore publish files 81 | /publish/* 82 | 83 | #Ignore unity3d files 84 | /protocols/libAnySDKForUnity/Temp 85 | /Sample_Unity/Sample.apk 86 | /Sample_Unity/Temp 87 | /Sample_Unity/Library 88 | *.meta 89 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 AnySDK 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Sample_Cpp 2 | 3 | ### Samplefor AnySDK_Framework_C++ 2.0 4 | v2.0 -- 2015.5.29 5 | 库更新: 6 | 1、更新框架2.0 7 | 8 | ### Samplefor AnySDK_Framework_C++ 1.5 9 | v1.5 -- 2015.3.5 10 | 库更新: 11 | 1、新增接口获取框架版本号,开发者可通过AgentManager::getInstance()->getFrameworkVersion()获得版本号 12 | 13 | ### Samplefor AnySDK_Framework_C++1.4 14 | v1.4 -- 2015.1.4 15 | 库更新: 16 | 1、新增AnySDK统计,该统计只是统计了接口调用的次数,以方便AnySDK产品的分析,默认是开启的,如果开发者介意该统计可以调用 17 | AgentManager::getInstance()->setIsAnaylticsEnabled(false)关闭统计接口 18 | 19 | ### Samplefor AnySDK_Framework_C++1.3.0 20 | 1、更新框架1.3.0.1 21 | 22 | ### Sample_1.0.8 for AnySDK_Framework_C++1.2.3 23 | 24 | v1.0.8 -- 2014.09.25 25 | 库更新: 26 | 1、更新框架1.2.3 27 | 2、用户系统接口isSupportFunction改为isFunctionSupported 28 | 3、广告系统接口作调整 29 |  a、接口支持多个广告位功能 30 |  b、新增预加载功能preloadAds 31 | 4、统计系统接口作调整,支持游戏相关统计 32 |  a、游戏账号信息统计接口setAccount 33 |  b、支付相关接口:onChargeRequest、onChargeOnlySuccess、onChargeSuccess、onChargeFail 34 |  c、游戏支付相关接口:onPurchase、onUse、onReward 35 |  d、关卡相关接口:startLevel、finishLevel、failLevel 36 |  e、任务相关接口:startTask、finishTask、failTask 37 | 38 | ### v1.0.6 -- 2014.08.18 39 | 库更新: 40 | 1、更新框架2.0.6 41 | 42 | 43 | ### v1.0.5 -- 2014.07.18 44 | 库更新: 45 | 1、更新框架2.0.5 46 | 47 | ### v1.0.4 -- 2014.06.23 48 | 库更新: 49 | 1、更新框架2.0.4 50 | 2、Sample修复getUserId的实现 51 | 3、新增支付回调支付进行中处理 52 | 53 | ### v1.0.2 -- 2014.05.30 54 | 库更新: 55 | 1、更新框架2.0.2 56 | 2、Sample增加Push系统范例 57 | 58 | -------------------------------------------------------------------------------- /manual.txt: -------------------------------------------------------------------------------- 1 | http://docs.anysdk.com/ -------------------------------------------------------------------------------- /proj.android/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /proj.android/.externalToolBuilders/org.eclipse.cdt.managedbuilder.core.genmakebuilder.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /proj.android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sample 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.ui.externaltools.ExternalToolBuilder 10 | full,incremental, 11 | 12 | 13 | LaunchConfigHandle 14 | <project>/.externalToolBuilders/org.eclipse.cdt.managedbuilder.core.genmakebuilder.launch 15 | 16 | 17 | 18 | 19 | com.android.ide.eclipse.adt.ResourceManagerBuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.PreCompilerBuilder 25 | 26 | 27 | 28 | 29 | org.eclipse.jdt.core.javabuilder 30 | 31 | 32 | 33 | 34 | com.android.ide.eclipse.adt.ApkBuilder 35 | 36 | 37 | 38 | 39 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 40 | full,incremental, 41 | 42 | 43 | 44 | 45 | 46 | com.android.ide.eclipse.adt.AndroidNature 47 | org.eclipse.jdt.core.javanature 48 | org.eclipse.cdt.core.cnature 49 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 50 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 51 | org.eclipse.cdt.core.ccnature 52 | 53 | 54 | -------------------------------------------------------------------------------- /proj.android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /proj.android/build_native.sh: -------------------------------------------------------------------------------- 1 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 2 | NDK_ROOT=/Users/daisy/Documents/software/sdk/adt-bundle-mac-x86_64/android-ndk-r9d 3 | $NDK_ROOT/ndk-build -C $DIR \ 4 | "NDK_MODULE_PATH=$DIR" 5 | -------------------------------------------------------------------------------- /proj.android/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnySDK/Sample_Cpp/9a336ec23b762f86ed990519b1857047567ad4fb/proj.android/ic_launcher-web.png -------------------------------------------------------------------------------- /proj.android/jni/AdTracking.h: -------------------------------------------------------------------------------- 1 | // 2 | // AdTracking.h 3 | // sample 4 | // 5 | // Created by cocos2dx on 14-11-10. 6 | // Copyright (c) 2014年 cocos2dx. All rights reserved. 7 | // 8 | 9 | #ifndef __MY_ADTRACKING_H__ 10 | #define __MY_ADTRACKING_H__ 11 | 12 | #include "AgentManager.h" 13 | #include 14 | using namespace std; 15 | 16 | using namespace anysdk::framework; 17 | 18 | class AdTracking 19 | { 20 | public: 21 | static AdTracking* getInstance(); 22 | static void purge(); 23 | 24 | void onRegister(); 25 | 26 | void onLogin(); 27 | 28 | void onPay(); 29 | 30 | void trackEvent(); 31 | 32 | void onStartToPay(); 33 | 34 | void onCreateRole(); 35 | 36 | void onLevelUp(); 37 | 38 | bool isFunctionSupported(string functionName); 39 | template 40 | static std::string ConvertToString(T value) { 41 | std::stringstream ss; 42 | ss << value; 43 | return ss.str(); 44 | } 45 | 46 | 47 | private: 48 | AdTracking(); 49 | virtual ~AdTracking(); 50 | 51 | static AdTracking* _pInstance; 52 | 53 | ProtocolAdTracking* _pAdTracking; 54 | 55 | }; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /proj.android/jni/Ads.cpp: -------------------------------------------------------------------------------- 1 | #include "Ads.h" 2 | #include 3 | #include 4 | #include "PluginJniHelper.h" 5 | #include 6 | 7 | using namespace anysdk::framework; 8 | 9 | #define LOG_TAG "Ads" 10 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG,__VA_ARGS__); 11 | extern "C"{ 12 | void Java_com_anysdk_sample_wrapper_nativeShowAds(JNIEnv* env, jobject thiz, jint type, jint index) 13 | { 14 | Ads::getInstance()->showAds(type, index); 15 | } 16 | void Java_com_anysdk_sample_wrapper_nativeHideAds(JNIEnv* env, jobject thiz, jint type, jint index) 17 | { 18 | Ads::getInstance()->hideAds(type, index); 19 | } 20 | 21 | void Java_com_anysdk_sample_wrapper_nativePreloadAds(JNIEnv* env, jobject thiz, jint type, jint index) 22 | { 23 | Ads::getInstance()->preloadAds(type, index); 24 | } 25 | 26 | void Java_com_anysdk_sample_wrapper_nativeSpendPoints(JNIEnv* env, jobject thiz) 27 | { 28 | Ads::getInstance()->spendPoints(); 29 | } 30 | 31 | jfloat Java_com_anysdk_sample_wrapper_nativeQueryPoints(JNIEnv* env, jobject thiz) 32 | { 33 | return (jfloat)Ads::getInstance()->queryPoints(); 34 | } 35 | } 36 | 37 | 38 | Ads* Ads::_pInstance = NULL; 39 | 40 | Ads::Ads() 41 | { 42 | _pAds = AgentManager::getInstance()->getAdsPlugin(); 43 | if(!_pAds) return; 44 | 45 | _pAds->setAdsListener(this); 46 | } 47 | 48 | Ads::~Ads() 49 | { 50 | 51 | } 52 | 53 | Ads* Ads::getInstance() 54 | { 55 | if (_pInstance == NULL) { 56 | _pInstance = new Ads(); 57 | } 58 | return _pInstance; 59 | } 60 | 61 | void Ads::purge() 62 | { 63 | if (_pInstance) 64 | { 65 | delete _pInstance; 66 | _pInstance = NULL; 67 | } 68 | } 69 | 70 | void Ads::onAdsResult(AdsResultCode code, const char* msg) 71 | { 72 | LOGD("adsCallback %d,%s",code, msg); 73 | switch(code) 74 | { 75 | case kAdsReceived://广告接受成功回调 76 | 77 | break; 78 | case kAdsShown://广告展示回调 79 | 80 | break; 81 | case kAdsDismissed://广告消失回调 82 | 83 | break; 84 | case kPointsSpendSucceed://积分设置成功回调 85 | 86 | break; 87 | case kPointsSpendFailed://积分设置失败回调 88 | 89 | break; 90 | case kNetworkError://网络错误回调 91 | 92 | break; 93 | case kUnknownError://未知错误回调 94 | 95 | break; 96 | case kOfferWallOnPointsChanged://积分改变回调 97 | 98 | break; 99 | default: 100 | break; 101 | } 102 | 103 | } 104 | 105 | 106 | void Ads::showAds(int type,int index) 107 | { 108 | LOGD("showAds"); 109 | if(!_pAds || !(_pAds->isAdTypeSupported((AdsType)type))) return; 110 | _pAds->showAds((AdsType)type, index); 111 | 112 | } 113 | 114 | void Ads::hideAds(int type,int index) 115 | { 116 | if(!_pAds || !(_pAds->isAdTypeSupported((AdsType)type))) return; 117 | _pAds->hideAds((AdsType)type, index); 118 | } 119 | void Ads::preloadAds(int type,int index) 120 | { 121 | if(!_pAds || !(_pAds->isAdTypeSupported((AdsType)type))) return; 122 | _pAds->preloadAds((AdsType)type, index); 123 | } 124 | 125 | void Ads::spendPoints() 126 | { 127 | if(!_pAds) return; 128 | _pAds->spendPoints(100); 129 | } 130 | 131 | float Ads::queryPoints() 132 | { 133 | if(!_pAds) return -1.0; 134 | return _pAds->queryPoints(); 135 | } 136 | 137 | 138 | -------------------------------------------------------------------------------- /proj.android/jni/Ads.h: -------------------------------------------------------------------------------- 1 | #ifndef __MY_Ads_H__ 2 | #define __MY_Ads_H__ 3 | 4 | #include "AgentManager.h" 5 | #include "string.h" 6 | using namespace anysdk::framework; 7 | using namespace std; 8 | class Ads:public AdsListener 9 | { 10 | public: 11 | static Ads* getInstance(); 12 | static void purge(); 13 | 14 | //广告系统 15 | 16 | //广告回调函数 17 | virtual void onAdsResult(AdsResultCode code, const char* msg); 18 | 19 | //广告系统展示 20 | void showAds(int type,int index); 21 | 22 | //广告系统隐藏 23 | void hideAds(int type,int index); 24 | 25 | void preloadAds(int type,int index); 26 | 27 | void spendPoints(); 28 | 29 | float queryPoints(); 30 | 31 | 32 | private: 33 | Ads(); 34 | virtual ~Ads(); 35 | 36 | static Ads* _pInstance; 37 | 38 | ProtocolAds* _pAds; 39 | 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /proj.android/jni/Analytics.h: -------------------------------------------------------------------------------- 1 | #ifndef __MY_ANALYTICS_H__ 2 | #define __MY_ANALYTICS_H__ 3 | 4 | #include "AgentManager.h" 5 | #include "string.h" 6 | #include 7 | using namespace anysdk::framework; 8 | using namespace std; 9 | class Analytics 10 | { 11 | public: 12 | static Analytics* getInstance(); 13 | static void purge(); 14 | 15 | 16 | //统计系统 17 | void startSession(); 18 | 19 | void stopSession(); 20 | 21 | void setSessionContinueMillis(long millis); 22 | void setCaptureUncaughtException(bool isEnabled); 23 | void logError(string errorId, string message); 24 | void logEvent(string eventId); 25 | void logEvent(string eventId, map paramMap); 26 | void logTimedEventBegin(string eventId); 27 | void logTimedEventEnd(string eventId); 28 | 29 | void setAccount(); 30 | void onChargeRequest(); 31 | void onChargeOnlySuccess(); 32 | void onChargeSuccess(); 33 | void onChargeFail(); 34 | void onPurchase(); 35 | void onUse(); 36 | void onReward(); 37 | void startLevel(); 38 | void finishLevel(); 39 | void failLevel(); 40 | void startTask(); 41 | void finishTask(); 42 | void failTask(); 43 | 44 | bool isFunctionSupported(string functionName); 45 | template 46 | static std::string ConvertToString(T value) { 47 | std::stringstream ss; 48 | ss << value; 49 | return ss.str(); 50 | } 51 | 52 | 53 | private: 54 | Analytics(); 55 | virtual ~Analytics(); 56 | 57 | static Analytics* _pInstance; 58 | 59 | ProtocolAnalytics* _pAnalytics; 60 | 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /proj.android/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := game_shared 6 | 7 | LOCAL_MODULE_FILENAME := libgame 8 | 9 | LOCAL_SRC_FILES := main.cpp PluginChannel.cpp Analytics.cpp Ads.cpp Share.cpp Social.cpp Push.cpp REC.cpp Crash.cpp AdTracking.cpp 10 | 11 | LOCAL_C_INCLUDES := $(LOCAL_PATH) 12 | 13 | LOCAL_WHOLE_STATIC_LIBRARIES := PluginProtocolStatic 14 | 15 | include $(BUILD_SHARED_LIBRARY) 16 | 17 | $(call import-module,protocols/android) 18 | -------------------------------------------------------------------------------- /proj.android/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_STL := gnustl_static 2 | NDK_TOOLCHAIN_VERSION=clang 3 | APP_CPPFLAGS += -frtti 4 | APP_ABI :=armeabi armeabi-v7a 5 | 6 | -------------------------------------------------------------------------------- /proj.android/jni/Crash.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Crash.m 3 | // sample 4 | // 5 | // Created by cocos2dx on 14-11-10. 6 | // Copyright (c) 2014年 cocos2dx. All rights reserved. 7 | // 8 | 9 | #include "Crash.h" 10 | #include 11 | #include 12 | #include "PluginJniHelper.h" 13 | extern "C"{ 14 | 15 | void Java_com_anysdk_sample_wrapper_nativeReportException(JNIEnv* env, jobject thiz) 16 | { 17 | Crash::getInstance()->reportException(); 18 | } 19 | 20 | void Java_com_anysdk_sample_wrapper_nativeSetUserIdentifier(JNIEnv* env, jobject thiz) 21 | { 22 | Crash::getInstance()->setUserIdentifier(); 23 | } 24 | 25 | void Java_com_anysdk_sample_wrapper_nativeLeaveBreadcrumb(JNIEnv* env, jobject thiz) 26 | { 27 | Crash::getInstance()->leaveBreadcrumb(); 28 | } 29 | } 30 | 31 | Crash* Crash::_pInstance = NULL; 32 | 33 | Crash::Crash() 34 | { 35 | // setListener(); 36 | } 37 | 38 | Crash::~Crash() 39 | { 40 | 41 | } 42 | 43 | Crash* Crash::getInstance() 44 | { 45 | if (_pInstance == NULL) { 46 | _pInstance = new Crash(); 47 | _pInstance->_Crash = AgentManager::getInstance()->getCrashPlugin(); 48 | } 49 | return _pInstance; 50 | } 51 | 52 | void Crash::purge() 53 | { 54 | if (_pInstance) 55 | { 56 | delete _pInstance; 57 | _pInstance = NULL; 58 | } 59 | } 60 | 61 | //设置用户唯一标示符 62 | void Crash::setUserIdentifier() 63 | { 64 | if(_Crash) 65 | { 66 | _Crash->setUserIdentifier("AnySDK"); 67 | } 68 | 69 | } 70 | 71 | //手动上报Exception 72 | void Crash::reportException() 73 | { 74 | if(_Crash) 75 | { 76 | _Crash->reportException("message", "exception"); 77 | string message = NULL; 78 | message.size(); 79 | } 80 | 81 | } 82 | 83 | //设置面包屑 84 | void Crash::leaveBreadcrumb() 85 | { 86 | if(_Crash) 87 | { 88 | _Crash->leaveBreadcrumb("bread"); 89 | } 90 | 91 | } 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /proj.android/jni/Crash.h: -------------------------------------------------------------------------------- 1 | // 2 | // Crash.h 3 | // sample 4 | // 5 | // Created by cocos2dx on 14-11-10. 6 | // Copyright (c) 2014年 cocos2dx. All rights reserved. 7 | // 8 | #ifndef __MY_Crash_H__ 9 | #define __MY_Crash_H__ 10 | 11 | #include "AgentManager.h" 12 | 13 | using namespace anysdk::framework; 14 | 15 | 16 | class Crash 17 | { 18 | public: 19 | static Crash* getInstance(); 20 | static void purge(); 21 | 22 | //设置用户唯一标示符 23 | void setUserIdentifier(); 24 | 25 | //手动上报Exception 26 | void reportException(); 27 | 28 | //设置面包屑 29 | void leaveBreadcrumb(); 30 | 31 | 32 | 33 | private: 34 | Crash(); 35 | virtual ~Crash(); 36 | 37 | static Crash* _pInstance; 38 | 39 | ProtocolCrash* _Crash; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /proj.android/jni/PluginChannel.h: -------------------------------------------------------------------------------- 1 | #ifndef __MY_PURCHASE_H__ 2 | #define __MY_PURCHASE_H__ 3 | 4 | #include "AgentManager.h" 5 | #include "string.h" 6 | #include "Analytics.h" 7 | using namespace anysdk::framework; 8 | using namespace std; 9 | class PluginChannel:public PayResultListener, public UserActionListener 10 | { 11 | public: 12 | static PluginChannel* getInstance(); 13 | static void purge(); 14 | 15 | //载入插件,同时进行插件的初始化 16 | void loadPlugins(); 17 | 18 | //卸载插件 19 | void unloadPlugins(); 20 | 21 | //用户系统功能 22 | //当前插件id 23 | string getPluginId(); 24 | 25 | //该方法是否支持:(login、getUserId为默认,可无需判断) 26 | bool isFunctionSupported(string strClassName); 27 | 28 | //登陆 29 | void login(); 30 | 31 | //获取用户唯一标识符,进行游戏端登陆 32 | bool isLogined(); 33 | 34 | //登出 35 | void logout(); 36 | 37 | 38 | //获取用户唯一标识符,进行游戏端登陆 39 | std::string getUserId(); 40 | 41 | 42 | //进入渠道用户中心 43 | void enterPlatform(); 44 | 45 | //显示悬浮按钮 46 | void showToolBar(ToolBarPlace place); 47 | 48 | //隐藏悬浮按钮 49 | void hideToolBar(); 50 | 51 | //渠道退出界面调用 52 | void Exit(); 53 | 54 | //sdk退出 55 | void destroy(); 56 | 57 | //渠道暂停界面调用 58 | void pause(); 59 | 60 | //切换账号 61 | void accountSwitch(); 62 | 63 | //用户实名注册(360特有函数) 64 | void realNameRegister(); 65 | 66 | //防沉迷(360特有函数) 67 | void antiAddictionQuery(); 68 | //UC提交角色信息(UC特有函数) 69 | void submitLoginGameRole(); 70 | 71 | //支付系统功能 72 | void pay(); 73 | void resetPayState(); 74 | std::string getOrderId(); 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | //支付回调函数 86 | virtual void onPayResult(PayResultCode ret, const char* msg, TProductInfo info); 87 | 88 | //登陆回调函数 89 | virtual void onActionResult(ProtocolUser* pPlugin, UserActionResultCode code, const char* msg); 90 | 91 | 92 | 93 | 94 | 95 | void payMode(std::string id); 96 | 97 | //获取渠道id 98 | std::string getChannelId(); 99 | 100 | 101 | 102 | private: 103 | PluginChannel(); 104 | virtual ~PluginChannel(); 105 | 106 | static PluginChannel* _pInstance; 107 | std::map productInfo; 108 | std::map* _pluginsIAPMap; 109 | ProtocolUser* _pUser; 110 | AgentManager* _pAgent; 111 | Analytics* _pAnalytics; 112 | 113 | }; 114 | 115 | #endif 116 | -------------------------------------------------------------------------------- /proj.android/jni/Push.cpp: -------------------------------------------------------------------------------- 1 | #include "Push.h" 2 | #include 3 | #include 4 | #include "PluginJniHelper.h" 5 | #include 6 | using namespace anysdk::framework; 7 | 8 | #define LOG_TAG "Push" 9 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG,__VA_ARGS__); 10 | 11 | extern "C"{ 12 | void Java_com_anysdk_sample_wrapper_nativeStartPush(JNIEnv* env, jobject thiz) 13 | { 14 | Push::getInstance()->startPush(); 15 | } 16 | 17 | void Java_com_anysdk_sample_wrapper_nativeClosePush(JNIEnv* env, jobject thiz) 18 | { 19 | Push::getInstance()->closePush(); 20 | } 21 | 22 | void Java_com_anysdk_sample_wrapper_nativeSetAlias(JNIEnv* env, jobject thiz) 23 | { 24 | Push::getInstance()->setAlias(); 25 | } 26 | 27 | void Java_com_anysdk_sample_wrapper_nativeDelAlias(JNIEnv* env, jobject thiz) 28 | { 29 | Push::getInstance()->delAlias(); 30 | } 31 | 32 | void Java_com_anysdk_sample_wrapper_nativeSetTags(JNIEnv* env, jobject thiz) 33 | { 34 | Push::getInstance()->setTags(); 35 | } 36 | void Java_com_anysdk_sample_wrapper_nativeDelTags(JNIEnv* env, jobject thiz) 37 | { 38 | Push::getInstance()->delTags(); 39 | } 40 | } 41 | 42 | 43 | Push* Push::_pInstance = NULL; 44 | 45 | Push::Push() 46 | { 47 | _pPush = AgentManager::getInstance()->getPushPlugin(); 48 | setListener(); 49 | } 50 | 51 | Push::~Push() 52 | { 53 | 54 | } 55 | 56 | Push* Push::getInstance() 57 | { 58 | if (_pInstance == NULL) { 59 | _pInstance = new Push(); 60 | } 61 | return _pInstance; 62 | } 63 | 64 | void Push::purge() 65 | { 66 | if (_pInstance) 67 | { 68 | delete _pInstance; 69 | _pInstance = NULL; 70 | } 71 | } 72 | 73 | void Push::setListener() 74 | { 75 | if(!_pPush) return; 76 | _pPush->setActionListener(this); 77 | } 78 | 79 | //开启推送 80 | void Push::startPush() 81 | { 82 | if(!_pPush) return; 83 | _pPush->startPush(); 84 | } 85 | 86 | //开启推送 87 | void Push::closePush() 88 | { 89 | if(!_pPush) return; 90 | _pPush->closePush(); 91 | 92 | } 93 | 94 | //设置别名 95 | void Push::setAlias() 96 | { 97 | if(!_pPush) return; 98 | _pPush->setAlias("anysdk"); 99 | } 100 | 101 | //删除别名 102 | void Push::delAlias() 103 | { 104 | if(!_pPush) return; 105 | _pPush->delAlias("anysdk"); 106 | } 107 | 108 | //设置标签 109 | void Push::setTags() 110 | { 111 | if(!_pPush) return; 112 | list tags; 113 | tags.push_back("easy"); 114 | tags.push_back("fast"); 115 | _pPush->setTags(tags); 116 | } 117 | 118 | //删除标签 119 | void Push::delTags() 120 | { 121 | if(!_pPush) return; 122 | list tags; 123 | tags.push_back("easy"); 124 | tags.push_back("fast"); 125 | _pPush->delTags(tags); 126 | } 127 | 128 | //Push回调函数 129 | void Push::onActionResult(ProtocolPush* pPlugin, PushActionResultCode code, const char* msg) 130 | { 131 | LOGD("Push::onActionResult %d -- %s",code,msg); 132 | switch(code) 133 | { 134 | case kPushReceiveMessage://Push接受到消息回调 135 | LOGD("kPushReceiveMessage ==> %s",msg); 136 | break; 137 | default: 138 | break; 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /proj.android/jni/Push.h: -------------------------------------------------------------------------------- 1 | #ifndef __MY_Push_H__ 2 | #define __MY_Push_H__ 3 | 4 | #include "AgentManager.h" 5 | #include "string.h" 6 | using namespace anysdk::framework; 7 | using namespace std; 8 | class Push:public PushActionListener 9 | { 10 | public: 11 | static Push* getInstance(); 12 | static void purge(); 13 | 14 | //推送系统 15 | 16 | void setListener(); 17 | 18 | //开启推送 19 | void startPush(); 20 | 21 | //开启推送 22 | void closePush(); 23 | 24 | //设置别名 25 | void setAlias(); 26 | 27 | //删除别名 28 | void delAlias(); 29 | 30 | //设置标签 31 | void setTags(); 32 | 33 | //删除标签 34 | void delTags(); 35 | 36 | 37 | 38 | //Push回调函数 39 | virtual void onActionResult(ProtocolPush* pPlugin, PushActionResultCode code, const char* msg); 40 | 41 | 42 | 43 | private: 44 | Push(); 45 | virtual ~Push(); 46 | 47 | static Push* _pInstance; 48 | 49 | ProtocolPush* _pPush; 50 | 51 | }; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /proj.android/jni/REC.h: -------------------------------------------------------------------------------- 1 | // 2 | // REC.h 3 | // sample 4 | // 5 | // Created by cocos2dx on 14-11-10. 6 | // Copyright (c) 2014年 cocos2dx. All rights reserved. 7 | // 8 | #ifndef __MY_REC_H__ 9 | #define __MY_REC_H__ 10 | 11 | #include "AgentManager.h" 12 | 13 | using namespace anysdk::framework; 14 | 15 | class REC : public RECResultListener 16 | { 17 | public: 18 | static REC* getInstance(); 19 | static void purge(); 20 | 21 | //分享系统 22 | 23 | void setListener(); 24 | 25 | void startRecording(); 26 | void stopRecording(); 27 | void share(); 28 | 29 | 30 | void pauseRecording(); 31 | void resumeRecording(); 32 | bool isAvailable(); 33 | void showToolBar(); 34 | void hideToolBar(); 35 | bool isRecording(); 36 | void showVideoCenter(); 37 | void enterPlatform(); 38 | void setMetaData(); 39 | 40 | bool isFunctionSupported(string strClassName); 41 | 42 | //分享回调函数 43 | virtual void onRECResult(RECResultCode ret, const char* msg); 44 | 45 | 46 | 47 | private: 48 | REC(); 49 | virtual ~REC(); 50 | 51 | static REC* _pInstance; 52 | 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /proj.android/jni/Share.cpp: -------------------------------------------------------------------------------- 1 | #include "Share.h" 2 | #include 3 | #include 4 | #include "PluginJniHelper.h" 5 | #include 6 | using namespace anysdk::framework; 7 | #define LOG_TAG "Share" 8 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG,__VA_ARGS__); 9 | extern "C"{ 10 | void Java_com_anysdk_sample_wrapper_nativeShare(JNIEnv* env, jobject thiz) 11 | { 12 | Share::getInstance()->share(); 13 | } 14 | } 15 | 16 | 17 | Share* Share::_pInstance = NULL; 18 | 19 | Share::Share() 20 | { 21 | _pShare = AgentManager::getInstance()->getSharePlugin(); 22 | setListener(); 23 | 24 | } 25 | 26 | Share::~Share() 27 | { 28 | 29 | 30 | } 31 | 32 | Share* Share::getInstance() 33 | { 34 | if (_pInstance == NULL) { 35 | _pInstance = new Share(); 36 | } 37 | return _pInstance; 38 | } 39 | 40 | void Share::purge() 41 | { 42 | if (_pInstance) 43 | { 44 | delete _pInstance; 45 | _pInstance = NULL; 46 | } 47 | } 48 | 49 | void Share::setListener() 50 | { 51 | if(!_pShare) return; 52 | _pShare->setResultListener(this); 53 | } 54 | 55 | void Share::share() 56 | { 57 | if(!_pShare) return; 58 | 59 | std::map info; 60 | // title标题,印象笔记、邮箱、信息、微信、人人网和QQ空间使用 61 | info["title"] = "ShareSDK是一个神奇的SDK"; 62 | // titleUrl是标题的网络链接,仅在人人网和QQ空间使用 63 | info["titleUrl"] = "http://sharesdk.cn"; 64 | // site是分享此内容的网站名称,仅在QQ空间使用 65 | info["site"] = "ShareSDK"; 66 | // siteUrl是分享此内容的网站地址,仅在QQ空间使用 67 | info["siteUrl"] = "http://sharesdk.cn"; 68 | 69 | // imagePath是图片的本地路径,Linked-In以外的平台都支持此参数 70 | info["imagePath"] = "/sdcard/test.png"; 71 | // imageUrl是图片的网络路径,新浪微博,人人网,QQ空间支持此字段 72 | info["imageUrl"] = "http://www.baidu.com/img/bdlogo.png?tn=63090008_1_hao_pg"; 73 | 74 | // url仅在微信(包括好友和朋友圈)中使用 75 | info["url"] ="http://sharesdk.cn"; 76 | 77 | // text是分享文本,所有平台都需要这个字段 78 | info["text"] = "ShareSDK支持如微信、新浪微博、腾讯微博等社交平台"; 79 | // comment是我对这条分享的评论,仅在人人网和QQ空间使用 80 | info["comment"] = "无"; 81 | 82 | _pShare->share(info); 83 | 84 | } 85 | 86 | void Share::onShareResult(ShareResultCode ret, const char* msg) 87 | { 88 | LOGD("onShareResult %d",ret); 89 | switch(ret) 90 | { 91 | case kShareSuccess://分享成功回调 92 | LOGD("onShareResult success"); 93 | break; 94 | case kShareFail://分享失败回调 95 | LOGD("onShareResult fail"); 96 | break; 97 | case kShareCancel://分享取消回调 98 | LOGD("onShareResult cancel"); 99 | break; 100 | case kShareNetworkError://分享网络出错回调 101 | LOGD("onShareResult error"); 102 | break; 103 | default: 104 | break; 105 | } 106 | } 107 | 108 | 109 | -------------------------------------------------------------------------------- /proj.android/jni/Share.h: -------------------------------------------------------------------------------- 1 | #ifndef __MY_Share_H__ 2 | #define __MY_Share_H__ 3 | 4 | #include "AgentManager.h" 5 | #include "string.h" 6 | using namespace anysdk::framework; 7 | using namespace std; 8 | class Share:public ShareResultListener 9 | { 10 | public: 11 | static Share* getInstance(); 12 | static void purge(); 13 | 14 | //分享系统 15 | 16 | void setListener(); 17 | 18 | //分享系统功能 19 | void share(); 20 | 21 | //分享回调函数 22 | virtual void onShareResult(ShareResultCode ret, const char* msg); 23 | 24 | 25 | 26 | private: 27 | Share(); 28 | virtual ~Share(); 29 | 30 | static Share* _pInstance; 31 | ProtocolShare* _pShare; 32 | 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /proj.android/jni/Social.cpp: -------------------------------------------------------------------------------- 1 | #include "Social.h" 2 | #include 3 | #include 4 | #include "PluginJniHelper.h" 5 | #include 6 | using namespace anysdk::framework; 7 | 8 | #define LOG_TAG "Social" 9 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG,__VA_ARGS__); 10 | 11 | extern "C"{ 12 | void Java_com_anysdk_sample_wrapper_nativeSignIn(JNIEnv* env, jobject thiz) 13 | { 14 | Social::getInstance()->signIn(); 15 | } 16 | 17 | void Java_com_anysdk_sample_wrapper_nativeSignOut(JNIEnv* env, jobject thiz) 18 | { 19 | Social::getInstance()->signOut(); 20 | } 21 | 22 | void Java_com_anysdk_sample_wrapper_nativeSubmitScore(JNIEnv* env, jobject thiz) 23 | { 24 | Social::getInstance()->submitScore(); 25 | } 26 | 27 | void Java_com_anysdk_sample_wrapper_nativeShowLeaderboard(JNIEnv* env, jobject thiz) 28 | { 29 | Social::getInstance()->showLeaderboard(); 30 | } 31 | 32 | void Java_com_anysdk_sample_wrapper_nativeUnlockAchievement(JNIEnv* env, jobject thiz) 33 | { 34 | Social::getInstance()->unlockAchievement(); 35 | } 36 | 37 | void Java_com_anysdk_sample_wrapper_nativeShowAchievements(JNIEnv* env, jobject thiz) 38 | { 39 | Social::getInstance()->showAchievements(); 40 | } 41 | } 42 | 43 | Social* Social::_pInstance = NULL; 44 | 45 | Social::Social() 46 | { 47 | _pSocial = AgentManager::getInstance()->getSocialPlugin(); 48 | setListener(); 49 | 50 | 51 | } 52 | 53 | Social::~Social() 54 | { 55 | 56 | } 57 | 58 | Social* Social::getInstance() 59 | { 60 | if (_pInstance == NULL) { 61 | _pInstance = new Social(); 62 | } 63 | return _pInstance; 64 | } 65 | 66 | void Social::purge() 67 | { 68 | if (_pInstance) 69 | { 70 | delete _pInstance; 71 | _pInstance = NULL; 72 | } 73 | } 74 | 75 | void Social::setListener() 76 | { 77 | if(!_pSocial) return; 78 | 79 | _pSocial->setListener(this); 80 | } 81 | 82 | void Social::signIn() 83 | { 84 | if(!_pSocial) return; 85 | 86 | _pSocial->signIn(); 87 | } 88 | 89 | void Social::signOut() 90 | { 91 | if(!_pSocial) return; 92 | 93 | _pSocial->signOut(); 94 | } 95 | 96 | void Social::submitScore() 97 | { 98 | if(!_pSocial) return; 99 | 100 | _pSocial->submitScore("friend",1); 101 | } 102 | 103 | void Social::showLeaderboard() 104 | { 105 | if(!_pSocial) return; 106 | 107 | _pSocial->showLeaderboard("friends"); 108 | } 109 | 110 | void Social::unlockAchievement() 111 | { 112 | if(!_pSocial) return; 113 | 114 | TAchievementInfo achInfo; 115 | achInfo["rank"] = "friends"; 116 | _pSocial->unlockAchievement(achInfo); 117 | } 118 | 119 | void Social::showAchievements() 120 | { 121 | if(!_pSocial) return; 122 | 123 | _pSocial->showAchievements(); 124 | } 125 | 126 | 127 | //社交回调函数 128 | void Social::onSocialResult(SocialRetCode code, const char* msg) 129 | { 130 | LOGD("onSocialResult %d -- %s",code,msg); 131 | switch(code) 132 | { 133 | case kScoreSubmitSucceed://提交分数成功回调 134 | 135 | break; 136 | case kScoreSubmitfail://提交分数失败回调 137 | 138 | break; 139 | case kAchUnlockSucceed://解锁成F就成功回调 140 | 141 | break; 142 | case kAchUnlockFail://解锁成就失败回调 143 | 144 | break; 145 | default: 146 | break; 147 | } 148 | } 149 | 150 | 151 | -------------------------------------------------------------------------------- /proj.android/jni/Social.h: -------------------------------------------------------------------------------- 1 | #ifndef __MY_SOCIAL_H__ 2 | #define __MY_SOCIAL_H__ 3 | 4 | #include "AgentManager.h" 5 | #include "string.h" 6 | using namespace anysdk::framework; 7 | using namespace std; 8 | class Social:public SocialListener 9 | { 10 | public: 11 | static Social* getInstance(); 12 | static void purge(); 13 | 14 | //社交系统 15 | 16 | void setListener(); 17 | 18 | void signIn(); 19 | void signOut(); 20 | void submitScore(); 21 | void showLeaderboard(); 22 | 23 | void unlockAchievement(); 24 | 25 | void showAchievements(); 26 | 27 | 28 | //社交回调函数 29 | virtual void onSocialResult(SocialRetCode code, const char* msg); 30 | 31 | 32 | 33 | private: 34 | Social(); 35 | virtual ~Social(); 36 | 37 | static Social* _pInstance; 38 | ProtocolSocial* _pSocial; 39 | 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /proj.android/libs/armeabi-v7a/libgame.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnySDK/Sample_Cpp/9a336ec23b762f86ed990519b1857047567ad4fb/proj.android/libs/armeabi-v7a/libgame.so -------------------------------------------------------------------------------- /proj.android/libs/armeabi/libgame.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnySDK/Sample_Cpp/9a336ec23b762f86ed990519b1857047567ad4fb/proj.android/libs/armeabi/libgame.so -------------------------------------------------------------------------------- /proj.android/lint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /proj.android/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /proj.android/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-17 15 | -------------------------------------------------------------------------------- /proj.android/protocols/android/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := PluginProtocolStatic 5 | LOCAL_MODULE_FILENAME := libPluginProtocolStatic 6 | LOCAL_SRC_FILES := ./lib/$(TARGET_ARCH_ABI)/libPluginProtocolStatic.a 7 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../include $(LOCAL_PATH) 8 | LOCAL_EXPORT_LDLIBS += -llog 9 | LOCAL_EXPORT_LDLIBS += -lz 10 | 11 | include $(PREBUILT_STATIC_LIBRARY) 12 | -------------------------------------------------------------------------------- /proj.android/protocols/android/PluginJavaData.h: -------------------------------------------------------------------------------- 1 | #ifndef __PLUGIN_JAVA_DATA_H__ 2 | #define __PLUGIN_JAVA_DATA_H__ 3 | 4 | #include 5 | #include 6 | 7 | namespace anysdk { namespace framework { 8 | 9 | typedef struct _PluginJavaData_ 10 | { 11 | jobject jobj; 12 | std::string jclassName; 13 | } PluginJavaData; 14 | 15 | }} //namespace anysdk { namespace framework { 16 | 17 | #endif // __PLUGIN_JAVA_DATA_H__ 18 | -------------------------------------------------------------------------------- /proj.android/protocols/android/PluginJniHelper.h: -------------------------------------------------------------------------------- 1 | #ifndef __PLUGIN_JNI_HELPER_H__ 2 | #define __PLUGIN_JNI_HELPER_H__ 3 | 4 | #include 5 | #include 6 | 7 | namespace anysdk {namespace framework{ 8 | 9 | typedef struct PluginJniMethodInfo_ 10 | { 11 | JNIEnv * env; 12 | jclass classID; 13 | jmethodID methodID; 14 | } PluginJniMethodInfo; 15 | 16 | class PluginJniHelper 17 | { 18 | public: 19 | static JavaVM* getJavaVM(); 20 | static void setJavaVM(JavaVM *javaVM); 21 | static JNIEnv* getEnv(); 22 | 23 | static bool getStaticMethodInfo(PluginJniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode); 24 | static bool getMethodInfo(PluginJniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode); 25 | static std::string jstring2string(jstring jstr); 26 | static jstring newStringUTF(JNIEnv* env, const std::string& utf8Str); 27 | 28 | static bool setClassLoaderFrom(jobject nativeActivityInstance); 29 | 30 | static jmethodID loadclassMethod_methodID; 31 | static jobject classloader; 32 | 33 | private: 34 | static JavaVM *_psJavaVM; 35 | static bool getMethodInfo_DefaultClassLoader(PluginJniMethodInfo &methodinfo, 36 | const char *className, 37 | const char *methodName, 38 | const char *paramCode); 39 | }; 40 | 41 | }} 42 | 43 | #endif // __PLUGIN_JNI_HELPER_H__ 44 | -------------------------------------------------------------------------------- /proj.android/protocols/android/Statistics.h: -------------------------------------------------------------------------------- 1 | #ifndef __STATISTICS_H__ 2 | #define __STATISTICS_H__ 3 | 4 | #include 5 | namespace anysdk { namespace framework { 6 | 7 | class Statistics 8 | { 9 | public: 10 | static void initInfo(); 11 | static void createPlugin(std::string pluginName, int pluginType); 12 | static void callFunction(std::string pluginName, std::string functionName); 13 | 14 | }; 15 | 16 | }} // namespace anysdk { namespace framework { 17 | 18 | #endif //__STATISTICS_H__ 19 | -------------------------------------------------------------------------------- /proj.android/protocols/android/lib/arm64-v8a/libPluginProtocolStatic.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnySDK/Sample_Cpp/9a336ec23b762f86ed990519b1857047567ad4fb/proj.android/protocols/android/lib/arm64-v8a/libPluginProtocolStatic.a -------------------------------------------------------------------------------- /proj.android/protocols/android/lib/armeabi-v7a/libPluginProtocolStatic.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnySDK/Sample_Cpp/9a336ec23b762f86ed990519b1857047567ad4fb/proj.android/protocols/android/lib/armeabi-v7a/libPluginProtocolStatic.a -------------------------------------------------------------------------------- /proj.android/protocols/android/lib/armeabi/libPluginProtocolStatic.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnySDK/Sample_Cpp/9a336ec23b762f86ed990519b1857047567ad4fb/proj.android/protocols/android/lib/armeabi/libPluginProtocolStatic.a -------------------------------------------------------------------------------- /proj.android/protocols/android/lib/x86/libPluginProtocolStatic.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnySDK/Sample_Cpp/9a336ec23b762f86ed990519b1857047567ad4fb/proj.android/protocols/android/lib/x86/libPluginProtocolStatic.a -------------------------------------------------------------------------------- /proj.android/protocols/android/libPluginProtocol.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnySDK/Sample_Cpp/9a336ec23b762f86ed990519b1857047567ad4fb/proj.android/protocols/android/libPluginProtocol.jar -------------------------------------------------------------------------------- /proj.android/protocols/include/JSBRelation.h: -------------------------------------------------------------------------------- 1 | /** @file JSBRelation.h 2 | */ 3 | #ifndef __CCX_JSBRELATION_H__ 4 | #define __CCX_JSBRELATION_H__ 5 | 6 | #include "PluginProtocol.h" 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace std; 12 | 13 | namespace anysdk { namespace framework { 14 | 15 | /**    16 |  *  @class  JSBRelation   17 | */ 18 | class JSBRelation 19 | { 20 | public: 21 | static string getMethodsOfPlugin(PluginProtocol* plugin); 22 | 23 | 24 | 25 | 26 | private: 27 | }; 28 | 29 | }} //namespace anysdk { namespace framework { 30 | 31 | #endif /* __CCX_JSBRELATION_H__ */ 32 | -------------------------------------------------------------------------------- /proj.android/protocols/include/PluginFactory.h: -------------------------------------------------------------------------------- 1 | /** @file PluginFactory.h 2 | */ 3 | #ifndef __CCX_PLUGIN_FACTORY_H__ 4 | #define __CCX_PLUGIN_FACTORY_H__ 5 | 6 | namespace anysdk { namespace framework { 7 | 8 | class PluginProtocol; 9 | class PluginManager; 10 | /**    11 |  *  @class  PluginFactory   12 | */ 13 | class PluginFactory 14 | { 15 | public: 16 | virtual ~PluginFactory(); 17 | /** 18 | @brief Get singleton of PluginFactory 19 | */ 20 | static PluginFactory* getInstance(); 21 | 22 | /** 23 | @brief Destory the instance of PluginFactory 24 | */ 25 | static void purgeFactory(); 26 | 27 | private: 28 | friend class PluginManager; 29 | PluginFactory(void); 30 | 31 | /** 32 | @brief create the plugin by name and type 33 | @param the name of plugin 34 | @param the type of plugin 35 | */ 36 | PluginProtocol* createPlugin(const char* name, int pluginType); 37 | }; 38 | 39 | }} //namespace anysdk { namespace framework { 40 | 41 | #endif /* __CCX_PLUGIN_FACTORY_H__ */ 42 | -------------------------------------------------------------------------------- /proj.android/protocols/include/PluginManager.h: -------------------------------------------------------------------------------- 1 | /** @file PluginFactory.h 2 | */ 3 | #ifndef __CCX_PLUGINMANAGER_H__ 4 | #define __CCX_PLUGINMANAGER_H__ 5 | 6 | #include "PluginProtocol.h" 7 | #include "PluginFactory.h" 8 | #include 9 | #include 10 | 11 | namespace anysdk { namespace framework { 12 | 13 | /**    14 |  *  @class  PluginManager   15 | */ 16 | class PluginManager 17 | { 18 | public: 19 | virtual ~PluginManager(); 20 | /** 21 | @brief Get singleton of PluginManager 22 | */ 23 | static PluginManager* getInstance(); 24 | /** 25 | @brief Destory the instance of PluginManager 26 | */ 27 | static void end(); 28 | 29 | /** 30 | @brief load the plugin by name and type 31 | @param the name of plugin 32 | @param the type of plugin 33 | */ 34 | PluginProtocol* loadPlugin(const char* name, int pluginType); 35 | /** 36 | @brief unload the plugin by name and type 37 | @param the name of plugin 38 | @param the type of plugin 39 | */ 40 | void unloadPlugin(const char* name, int pluginType = 0); 41 | 42 | 43 | private: 44 | PluginManager(void); 45 | std::map _pluginsMap; 46 | // bool _isDebug; 47 | }; 48 | 49 | }} //namespace anysdk { namespace framework { 50 | 51 | #endif /* __CCX_PLUGINMANAGER_H__ */ 52 | -------------------------------------------------------------------------------- /proj.android/protocols/include/PluginParam.h: -------------------------------------------------------------------------------- 1 | /** @file PluginParam.h 2 | */ 3 | #ifndef __CCX_PLUGIN_PARAM_H__ 4 | #define __CCX_PLUGIN_PARAM_H__ 5 | 6 | #include 7 | #include 8 | /// \typedef std::map StringMap 9 | /// typedef YString. 10 | typedef std::map StringMap; 11 | 12 | namespace anysdk { namespace framework { 13 | 14 | class PluginProtocol; 15 | /**    16 |  *  @class  PluginParam   17 | */ 18 | class PluginParam 19 | { 20 | public: 21 | /** 22 | @brief the default constructor of PluginParam 23 | */ 24 | PluginParam(); 25 | 26 | virtual ~PluginParam(); 27 | /** 28 | @brief the constructor of PluginParam 29 | @param the value is Integer 30 | */ 31 | PluginParam(int nValue); 32 | /** 33 | @brief the constructor of PluginParam 34 | @param the value is float 35 | */ 36 | PluginParam(float fValue); 37 | /** 38 | @brief the constructor of PluginParam 39 | @param the value is boolean 40 | */ 41 | PluginParam(bool bValue); 42 | /** 43 | @brief the default constructor of PluginParam 44 | @param the value is char 45 | */ 46 | PluginParam(const char* strValue); 47 | /** 48 | @brief the default constructor of PluginParam 49 | @param the value is StringMap 50 | */ 51 | PluginParam(StringMap strMapValue); 52 | 53 | typedef enum{ 54 | kParamTypeNull = 0, 55 | kParamTypeInt, 56 | kParamTypeFloat, 57 | kParamTypeBool, 58 | kParamTypeString, 59 | kParamTypeStringMap, 60 | kParamTypeMap, 61 | } ParamType; 62 | /** 63 | @brief get the ParamType of value 64 | */ 65 | inline ParamType getCurrentType() { 66 | return _type; 67 | } 68 | /** 69 | @brief get the int value 70 | */ 71 | inline int getIntValue() { 72 | return _intValue; 73 | } 74 | /** 75 | @brief get the float value 76 | */ 77 | inline float getFloatValue() { 78 | return _floatValue; 79 | } 80 | /** 81 | @brief get the boolean value 82 | */ 83 | inline bool getBoolValue() { 84 | return _boolValue; 85 | } 86 | /** 87 | @brief get the char value 88 | */ 89 | inline const char* getStringValue() { 90 | return _strValue.c_str(); 91 | } 92 | /** 93 | @brief get the map of value 94 | */ 95 | inline std::map getMapValue() { 96 | return _mapValue; 97 | } 98 | /** 99 | @brief get the StringMap value 100 | */ 101 | inline StringMap getStrMapValue() { 102 | return _strMapValue; 103 | } 104 | 105 | private: 106 | friend class PluginProtocol; 107 | /** 108 | @brief the constructor of PluginParam 109 | @param the map of value 110 | */ 111 | PluginParam(std::map mapValue); 112 | 113 | private: 114 | ParamType _type; 115 | 116 | int _intValue; 117 | float _floatValue; 118 | bool _boolValue; 119 | std::string _strValue; 120 | std::map _mapValue; 121 | StringMap _strMapValue; 122 | }; 123 | 124 | }} //namespace anysdk { namespace framework { 125 | 126 | #endif /* __CCX_PLUGIN_PARAM_H__ */ 127 | -------------------------------------------------------------------------------- /proj.android/protocols/include/ProtocolAdTracking.h: -------------------------------------------------------------------------------- 1 | /** @file ProtocolAdTracking.h 2 | */ 3 | #ifndef __CCX_PROTOCOL_ADTRACKING_H__ 4 | #define __CCX_PROTOCOL_ADTRACKING_H__ 5 | 6 | #include "PluginProtocol.h" 7 | #include 8 | namespace anysdk { namespace framework { 9 | /**    10 |  *@class  ProtocolAdTracking 11 | *@brief the interface of AdTracking   12 | */ 13 | class ProtocolAdTracking : public PluginProtocol 14 | { 15 | public: 16 | 17 | /** 18 | * 19 | * @Title: onRegister 20 | * @Description: Call this method if you want to track register events as happening during a section. 21 | * @param userId user identifier 22 | * @return void 23 | */ 24 | virtual void onRegister(const char* userId) = 0; 25 | 26 | /** 27 | * 28 | * @Title: onLogin 29 | * @Description:Call this method if you want to track login events as happening during a section. 30 | * @param userInfo The details of this parameters are already covered by document. 31 | * @return void 32 | */ 33 | virtual void onLogin(std::map userInfo) = 0; 34 | 35 | /** 36 | * 37 | * @Title: onPay 38 | * @Description: Call this method if you want to track pay events as happening during a section. 39 | * @param productInfo The details of this parameters are already covered by document. 40 | * @return void 41 | */ 42 | virtual void onPay(std::map productInfo) = 0; 43 | 44 | /** 45 | * 46 | * @Title: trackEvent 47 | * @Description: Call this method if you want to track custom events with parameters as happening during a section. 48 | * @param eventId The custom event name. 49 | * @param paramMap The details of this parameters are already covered by document. 50 | */ 51 | virtual void trackEvent(const char* eventId, std::map* paramMap = NULL) = 0; 52 | 53 | 54 | }; 55 | 56 | }} // namespace anysdk { namespace framework { 57 | 58 | #endif /* ----- #ifndef __CCX_PROTOCOL_ADTRACKING_H__ ----- */ 59 | -------------------------------------------------------------------------------- /proj.android/protocols/include/ProtocolAnalytics.h: -------------------------------------------------------------------------------- 1 | /** @file ProtocolAnalytics.h 2 | */ 3 | #ifndef __CCX_PROTOCOL_ANALYTICS_H__ 4 | #define __CCX_PROTOCOL_ANALYTICS_H__ 5 | 6 | #include "PluginProtocol.h" 7 | #include 8 | #include 9 | 10 | namespace anysdk { namespace framework { 11 | /// \typedef std::map LogEventParamPair 12 | /// typedef LogEventParamPair. 13 | typedef std::pair< std::string, std::string > LogEventParamPair; 14 | /// \typedef std::map LogEventParamMap 15 | /// typedef LogEventParamMap. 16 | typedef std::map< std::string, std::string > LogEventParamMap; 17 | typedef enum { 18 | ANONYMOUS,/**< enum value is anonymous typek. */ 19 | REGISTED,/**< enum value is registed type. */ 20 | SINA_WEIBO,/**< enum value is sineweibo type. */ 21 | TENCENT_WEIBO,/**< enum value is tecentweibo type */ 22 | QQ,/**< enum value is qq type */ 23 | ND91,/**< enum value is nd91 type. */ 24 | } AccountType; 25 | typedef enum { 26 | LOGIN,/**< enum value is the login operate. */ 27 | LOGOUT,/**< enum value is the logout operate. */ 28 | REGISTER,/**< enum value is the register operate. */ 29 | } AccountOperate; 30 | typedef enum { 31 | MALE,/**< enum value is male. */ 32 | FEMALE,/**< enum value is female. */ 33 | UNKNOWN,/**< enum value is unknow. */ 34 | 35 | } AccountGender; 36 | typedef enum { 37 | GUIDE_LINE,/**< enum value is the guideline type.. */ 38 | MAIN_LINE,/**< enum value is the mainline type.. */ 39 | BRANCH_LINE,/** 8 | #include 9 | 10 | namespace anysdk { namespace framework { 11 | 12 | class ProtocolCrash : public PluginProtocol 13 | { 14 | public: 15 | /** 16 | * set user identifier 17 | * 18 | * @param userInfo 19 | */ 20 | virtual void setUserIdentifier(const char* identifier) = 0; 21 | 22 | /** 23 | * The uploader captured in exception information 24 | * 25 | * @param message Set the custom information 26 | * @param exception The exception 27 | */ 28 | virtual void reportException(const char* message, const char* exception) = 0; 29 | 30 | /** 31 | * customize logging 32 | * 33 | * @param string Custom log 34 | */ 35 | virtual void leaveBreadcrumb(const char* breadcrumb) = 0; 36 | 37 | 38 | 39 | 40 | }; 41 | 42 | }} // namespace anysdk { namespace framework { 43 | 44 | #endif /* __CCX_PROTOCOL_CRASH_H__ */ 45 | -------------------------------------------------------------------------------- /proj.android/protocols/include/ProtocolCustom.h: -------------------------------------------------------------------------------- 1 | /** @file ProtocolCustom.h 2 | */ 3 | #ifndef __CCX_PROTOCOL_CUSTOM_H__ 4 | #define __CCX_PROTOCOL_CUSTOM_H__ 5 | 6 | #include "PluginProtocol.h" 7 | #include 8 | #include 9 | 10 | namespace anysdk { namespace framework { 11 | typedef enum 12 | { 13 | kCustomExtension = 80000 /**< enum value is extension code . */ 14 | } CustomResultCode; 15 | /**    16 |  *@class  CustomResultListener 17 | *@brief the interface of share callback   18 | */ 19 | class CustomResultListener 20 | { 21 | public: 22 | /**    23 | *@brief the interface of share callback  24 | *@param the id of callback 25 | *@param the information of callback 26 | */ 27 | virtual void onCustomResult(CustomResultCode ret, const char* msg) = 0; 28 | }; 29 | /**    30 |  *@class  ProtocolCustom 31 | *@brief the interface of custom   32 | */ 33 | class ProtocolCustom : public PluginProtocol 34 | { 35 | public: 36 | 37 | /** 38 | @breif set the result listener 39 | @param pListener The callback object for custom result 40 | @wraning Must invoke this interface before custom 41 | */ 42 | virtual void setResultListener(CustomResultListener* pListener) = 0; 43 | 44 | virtual CustomResultListener* getCustomListener() = 0; 45 | 46 | }; 47 | 48 | }} // namespace anysdk { namespace framework { 49 | 50 | #endif /* ----- #ifndef __CCX_PROTOCOL_Custom_H__ ----- */ 51 | -------------------------------------------------------------------------------- /proj.android/protocols/include/ProtocolPush.h: -------------------------------------------------------------------------------- 1 | /** @file PluginFactory.h 2 | */ 3 | #ifndef __CCX_PROTOCOL_PUSH_H__ 4 | #define __CCX_PROTOCOL_PUSH_H__ 5 | 6 | #include "PluginProtocol.h" 7 | #include 8 | #include 9 | #include 10 | using namespace std; 11 | 12 | namespace anysdk { namespace framework { 13 | /** @brief Plugin_type enum, with inline docs */ 14 | typedef enum 15 | { 16 | kPushReceiveMessage = 0,/**value is callback of Receiving Message . */ 17 | kPushExtensionCode = 60000 /**< enum value is extension code . */ 18 | 19 | 20 | } PushActionResultCode; 21 | class ProtocolPush; 22 | /**    23 |  *@class  PushActionListener 24 | *@brief the interface of Push callback   25 | */ 26 | class PushActionListener 27 | { 28 | public: 29 | /**    30 | *@brief the interface of Push callback  31 | *@param the adatper of plugin 32 | *@param the id of callback 33 | *@param the information of callback 34 | */ 35 | virtual void onActionResult(ProtocolPush* pPlugin, PushActionResultCode code, const char* msg) = 0; 36 | }; 37 | /**    38 |  *  @class  ProtocolPush   39 | */ 40 | class ProtocolPush : public PluginProtocol 41 | { 42 | public: 43 | 44 | 45 | /** 46 | *@brief start/register Push services 47 | *@return void 48 | */ 49 | virtual void startPush() = 0 ; 50 | 51 | 52 | /** 53 | *@brief close Push services 54 | *@return void 55 | */ 56 | virtual void closePush() = 0 ; 57 | 58 | 59 | /** 60 | *@brief set alias 61 | *@param tags 62 | *@return void 63 | */ 64 | virtual void setAlias(string alias) = 0; 65 | 66 | /** 67 | *@brief del alias 68 | *@param tags 69 | *@return void 70 | */ 71 | virtual void delAlias(string alias) = 0; 72 | 73 | /** 74 | *@brief set tag 75 | *@param tags 76 | *@return void 77 | */ 78 | virtual void setTags(list tags) = 0; 79 | 80 | /** 81 | *@brief delete tag 82 | *@param tags 83 | *@return void 84 | */ 85 | virtual void delTags(list tags) = 0; 86 | 87 | /** 88 | @brief set the result listener 89 | @param pListener The callback object for push result 90 | */ 91 | virtual void setActionListener(PushActionListener* listener) = 0 ; 92 | 93 | /** 94 | @brief get pListener The callback object for Push result 95 | @return the listener 96 | */ 97 | virtual PushActionListener* getActionListener() = 0 ; 98 | 99 | 100 | }; 101 | 102 | }} // namespace anysdk { namespace framework { 103 | 104 | #endif /* __CCX_PROTOCOL_PUSH_H__ */ 105 | -------------------------------------------------------------------------------- /proj.android/protocols/include/ProtocolREC.h: -------------------------------------------------------------------------------- 1 | /** @file ProtocolREC.h 2 | */ 3 | #ifndef __CCX_PROTOCOL_REC_H__ 4 | #define __CCX_PROTOCOL_REC_H__ 5 | 6 | #include "PluginProtocol.h" 7 | #include 8 | #include 9 | 10 | namespace anysdk { namespace framework { 11 | 12 | typedef std::map TVideoInfo; 13 | 14 | /** @brief RECResultCode enum, with inline docs */ 15 | typedef enum 16 | { 17 | kRECInitSuccess = 0,/**< enum value is callback of succeeding in initing sdk . */ 18 | kRECInitFail,/**< enum value is callback of failing to init sdk. */ 19 | kRECStartRecording,/**< enum value is callback of starting to record. */ 20 | kRECStopRecording,/**< enum value is callback of stoping to record. */ 21 | kRECPauseRecording,/**< enum value is callback of pausing to record. */ 22 | kRECResumeRecording,/**< enum value is callback of resuming to record. */ 23 | kRECEnterSDKPage,/**< enum value is callback of entering SDK`s page. */ 24 | kRECQuitSDKPage,/**< enum value is callback of quiting SDK`s page. */ 25 | kRECShareSuccess,/**< enum value is callback of succeeding in sharing. */ 26 | kRECShareFail,/**< enum value is callback of failing to share. */ 27 | kRECExtension = 90000 /**< enum value is extension code . */ 28 | } RECResultCode; 29 | /**    30 |  *@class  RECResultListener 31 | *@brief the interface of REC callback   32 | */ 33 | class RECResultListener 34 | { 35 | public: 36 | /**    37 | *@brief the interface of REC callback  38 | *@param the id of callback 39 | *@param the information of callback 40 | */ 41 | virtual void onRECResult(RECResultCode ret, const char* msg) = 0; 42 | }; 43 | /**    44 |  *@class  ProtocolREC 45 | *@brief the interface of REC   46 | */ 47 | class ProtocolREC : public PluginProtocol 48 | { 49 | public: 50 | 51 | /** 52 | * @Description: Start to record video 53 | */ 54 | virtual void startRecording() = 0; 55 | 56 | /** 57 | * @Description: Stop to record video 58 | */ 59 | virtual void stopRecording() = 0; 60 | 61 | /** 62 | * @Description: share video 63 | * @Param info The info of share 64 | */ 65 | virtual void share(TVideoInfo info) = 0; 66 | 67 | 68 | 69 | /** 70 | @breif set the result listener 71 | @param pListener The callback object for REC result 72 | @wraning Must invoke this interface before REC 73 | */ 74 | virtual void setResultListener(RECResultListener* pListener) = 0; 75 | 76 | virtual RECResultListener* getRECListener() = 0; 77 | 78 | 79 | }; 80 | 81 | }} // namespace anysdk { namespace framework { 82 | 83 | #endif /* ----- #ifndef __CCX_PROTOCOL_SHARE_H__ ----- */ 84 | -------------------------------------------------------------------------------- /proj.android/protocols/include/ProtocolShare.h: -------------------------------------------------------------------------------- 1 | /** @file ProtocolShare.h 2 | */ 3 | #ifndef __CCX_PROTOCOL_SHARE_H__ 4 | #define __CCX_PROTOCOL_SHARE_H__ 5 | 6 | #include "PluginProtocol.h" 7 | #include 8 | #include 9 | 10 | namespace anysdk { namespace framework { 11 | /// \typedef std::map TShareDeveloperInfo 12 | /// typedef TShareDeveloperInfo. 13 | typedef std::map TShareDeveloperInfo; 14 | /// \typedef std::map TShareInfo 15 | /// typedef TShareInfo. 16 | typedef std::map TShareInfo; 17 | /** @brief ShareResultCode enum, with inline docs */ 18 | typedef enum 19 | { 20 | kShareSuccess = 0,/**< enum value is callback of failing to sharing . */ 21 | kShareFail,/**< enum value is callback of failing to share . */ 22 | kShareCancel,/**< enum value is callback of canceling to share . */ 23 | kShareNetworkError,/**< enum value is callback of network error . */ 24 | kShareExtension = 10000 /**< enum value is extension code . */ 25 | } ShareResultCode; 26 | /**    27 |  *@class  ShareResultListener 28 | *@brief the interface of share callback   29 | */ 30 | class ShareResultListener 31 | { 32 | public: 33 | /**    34 | *@brief the interface of share callback  35 | *@param the id of callback 36 | *@param the information of callback 37 | */ 38 | virtual void onShareResult(ShareResultCode ret, const char* msg) = 0; 39 | }; 40 | /**    41 |  *@class  ProtocolShare 42 | *@brief the interface of share   43 | */ 44 | class ProtocolShare : public PluginProtocol 45 | { 46 | public: 47 | 48 | 49 | 50 | /** 51 | @brief share information 52 | @param info The info of share, contains key: 53 | SharedText The text need to share 54 | SharedImagePath The full path of image file need to share (optinal) 55 | @warning For different plugin, the parameter should have other keys to share. 56 | Look at the manual of plugins. */ 57 | virtual void share(TShareInfo info) = 0; 58 | 59 | /** 60 | @breif set the result listener 61 | @param pListener The callback object for share result 62 | @wraning Must invoke this interface before share 63 | */ 64 | virtual void setResultListener(ShareResultListener* pListener) = 0; 65 | 66 | virtual ShareResultListener* getShareListener() = 0; 67 | 68 | }; 69 | 70 | }} // namespace anysdk { namespace framework { 71 | 72 | #endif /* ----- #ifndef __CCX_PROTOCOL_SHARE_H__ ----- */ 73 | -------------------------------------------------------------------------------- /proj.android/protocols/include/ProtocolSocial.h: -------------------------------------------------------------------------------- 1 | /** @file ProtocolSocial.h 2 | */ 3 | #ifndef __CCX_PROTOCOL_SOCIAL_H__ 4 | #define __CCX_PROTOCOL_SOCIAL_H__ 5 | 6 | #include "PluginProtocol.h" 7 | #include 8 | #include 9 | 10 | namespace anysdk { namespace framework { 11 | /// \typedef std::map TSocialDeveloperInfo 12 | /// typedef TSocialDeveloperInfo. 13 | typedef std::map TSocialDeveloperInfo; 14 | /// \typedef std::map TAchievementInfo 15 | /// typedef TAchievementInfo. 16 | typedef std::map TAchievementInfo; 17 | /** @brief SocialRetCode enum, with inline docs */ 18 | typedef enum 19 | { 20 | // code for leaderboard feature 21 | kScoreSubmitSucceed =1,/**< enum value is callback of succeeding in submiting. */ 22 | kScoreSubmitfail,/**< enum value is callback of failing to submit . */ 23 | 24 | // code for achievement feature 25 | kAchUnlockSucceed,/**< enum value is callback of succeeding in unlocking. */ 26 | kAchUnlockFail,/**< enum value is callback of failing to unlock. */ 27 | 28 | kSocialSignInSucceed,/**< enum value is callback of succeeding to login. */ 29 | kSocialSignInFail,/**< enum value is callback of failing to login. */ 30 | 31 | kSocialSignOutSucceed,/**< enum value is callback of succeeding to login. */ 32 | kSocialSignOutFail,/**< enum value is callback of failing to login. */ 33 | kSocialGetGameFriends,/**< enum value is callback of getGameFriends. */ 34 | kSocialExtensionCode = 20000 /**< enum value is extension code . */ 35 | 36 | } SocialRetCode; 37 | /**    38 |  *@class  SocialListener 39 | *@brief the interface of social callback   40 | */ 41 | class SocialListener 42 | { 43 | public: 44 | /**    45 | *@brief the interface of social callback  46 | *@param the id of callback 47 | *@param the information of callback 48 | */ 49 | virtual void onSocialResult(SocialRetCode code, const char* msg) = 0; 50 | }; 51 | 52 | /**    53 |  *@class  ProtocolSocial 54 | *@brief the interface of social   55 | */ 56 | class ProtocolSocial : public PluginProtocol 57 | { 58 | public: 59 | 60 | /** 61 | @brief user signIn 62 | */ 63 | virtual void signIn() = 0; 64 | 65 | /** 66 | @brief user signOut 67 | */ 68 | virtual void signOut() = 0; 69 | 70 | /** 71 | @brief submit the score 72 | @param leaderboardID 73 | @param the score 74 | */ 75 | virtual void submitScore(const char* leadboardID, long score) = 0; 76 | /** 77 | @brief show the id of Leaderboard page 78 | @param leaderboardID 79 | */ 80 | virtual void showLeaderboard(const char* leaderboardID) = 0; 81 | 82 | /** 83 | @brief methods of achievement feature 84 | @param the info of achievement 85 | */ 86 | virtual void unlockAchievement(TAchievementInfo achInfo) = 0; 87 | /** 88 | @brief show the page of achievements 89 | */ 90 | virtual void showAchievements() = 0; 91 | /** 92 | @brief set pListener The callback object for social result 93 | @param the listener 94 | */ 95 | virtual void setListener(SocialListener* listener) = 0; 96 | /** 97 | @brief get pListener The callback object for social result 98 | @return the listener 99 | */ 100 | virtual SocialListener* getListener() = 0; 101 | }; 102 | 103 | }} // namespace anysdk { namespace framework { 104 | 105 | #endif /* ----- #ifndef __CCX_PROTOCOL_SOCIAL_H__ ----- */ 106 | -------------------------------------------------------------------------------- /proj.android/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnySDK/Sample_Cpp/9a336ec23b762f86ed990519b1857047567ad4fb/proj.android/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /proj.android/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnySDK/Sample_Cpp/9a336ec23b762f86ed990519b1857047567ad4fb/proj.android/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /proj.android/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnySDK/Sample_Cpp/9a336ec23b762f86ed990519b1857047567ad4fb/proj.android/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /proj.android/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnySDK/Sample_Cpp/9a336ec23b762f86ed990519b1857047567ad4fb/proj.android/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /proj.android/res/drawable/plugin_btn_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnySDK/Sample_Cpp/9a336ec23b762f86ed990519b1857047567ad4fb/proj.android/res/drawable/plugin_btn_close.png -------------------------------------------------------------------------------- /proj.android/res/drawable/plugin_ui_ad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnySDK/Sample_Cpp/9a336ec23b762f86ed990519b1857047567ad4fb/proj.android/res/drawable/plugin_ui_ad.png -------------------------------------------------------------------------------- /proj.android/res/layout/activity_ads.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 11 | 12 |