Skip to content

Commit

Permalink
add setDisableNetworkData api for android
Browse files Browse the repository at this point in the history
  • Loading branch information
af-margot committed Aug 21, 2022
1 parent 9c667d7 commit a1b5923
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Classes/AppsFlyer/AppsFlyerX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,3 +595,12 @@ void AppsFlyerX::generateUserInviteLink(cocos2d::ValueMap parameters, std::funct
AppsFlyerXApple::generateUserInviteLink(parameters, callback);
#endif
}

void AppsFlyerX::setDisableNetworkData(bool disable){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setDisableNetworkData(disable);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
//not supported for iOS
CCLOGWARN("%s", "setDisableNetworkData is not supported for iOS");
#endif
}
1 change: 1 addition & 0 deletions Classes/AppsFlyer/AppsFlyerX.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class AppsFlyerX {
static void generateUserInviteLink(cocos2d::ValueMap parameters,void(*onResponse)(std::string url), void(*onResponseError)(std::string url));
static void generateUserInviteLink(cocos2d::ValueMap parameters, std::function<void(std::string url)> callback);

static void setDisableNetworkData(bool disable);
};
#endif /* A;ppsFlyerX_h */

Expand Down
4 changes: 4 additions & 0 deletions Classes/AppsFlyer/AppsFlyerXAndroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1272,4 +1272,8 @@ void AppsFlyerXAndroid::logInvite(const std::string& channel, cocos2d::ValueMap

}
}

void AppsFlyerXAndroid::setDisableNetworkData(bool disable) {
callVoidMethodWithBoolParam(disable, "setDisableNetworkData", "(Z)V");
}
#endif
2 changes: 2 additions & 0 deletions Classes/AppsFlyer/AppsFlyerXAndroid.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ class AppsFlyerXAndroid {

static void generateInviteUrl(cocos2d::ValueMap parameter, void(*onResponse)(std::string url), void(*onResponseError)(std::string url));
static void logInvite(const std::string& channel,cocos2d::ValueMap parameters);

static void setDisableNetworkData(bool disable);
};


Expand Down
4 changes: 4 additions & 0 deletions proj.android-studio/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
applicationId "com.appsflyer.cocos2dX"
Expand Down
2 changes: 1 addition & 1 deletion proj.android-studio/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
PROP_COMPILE_SDK_VERSION=28

# Android SDK version that will be used as the earliest version of android this application can run on
PROP_MIN_SDK_VERSION=16
PROP_MIN_SDK_VERSION=26

# Android SDK version that will be used as the latest version of android this application has been tested on
PROP_TARGET_SDK_VERSION=28
Expand Down

0 comments on commit a1b5923

Please sign in to comment.