Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,12 @@ appsflyerSdk.initSdk(

2. Add the ATT pop-up for IDFA collection so your `AppDelegate.m` will look like this:
```
-(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
[GeneratedPluginRegistrant registerWithRegistry:self];
- (void)applicationDidBecomeActive:(nonnull UIApplication *)application {
if (@available(iOS 14, *)) {
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
//If you want to do something with the pop-up
// native code here
}];
}
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
```

Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.appsflyer:af-android-sdk:6.4.3'
implementation 'com.appsflyer:af-android-sdk:6.5.2'
implementation 'com.android.installreferrer:installreferrer:2.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ private void setSharingFilterForPartners(MethodCall call, Result result) {
}

private void setDisableAdvertisingIdentifiers(MethodCall call, Result result) {
isSetDisableAdvertisingIdentifiersEnable = (boolean) call.argument("isSetDisableAdvertisingIdentifiersEnable");
isSetDisableAdvertisingIdentifiersEnable = (boolean) call.arguments;
if (isSetDisableAdvertisingIdentifiersEnable) {
AppsFlyerLib.getInstance().setDisableAdvertisingIdentifiers(true);
} else {
Expand Down
11 changes: 11 additions & 0 deletions doc/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
- [setCurrentDeviceLanguage](#setCurrentDeviceLanguage)
- [setSharingFilterForPartners](#setSharingFilterForPartners)
- [setOneLinkCustomDomain](#setOneLinkCustomDomain)
- [setDisableAdvertisingIdentifiers](#setDisableAdvertisingIdentifiers)

---

##### <a id="appsflyer-options"> **`AppsflyerSdk(Map options)`**
Expand Down Expand Up @@ -516,4 +518,13 @@ _Example:_
```dart
appsFlyerSdk.setOneLinkCustomDomain(["promotion.greatapp.com","click.greatapp.com","deals.greatapp.com"]);
```
---
**<a id="setDisableAdvertisingIdentifiers"> `void setDisableAdvertisingIdentifiers(bool isSetDisableAdvertisingIdentifiersEnable)`**

Manually enable or disable Advertiser ID in Android & IDFA in iOS

_Example:_
```dart
widget.appsFlyerSdk.setDisableAdvertisingIdentifiers(true);
```
---
22 changes: 9 additions & 13 deletions doc/Guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -435,19 +435,15 @@ Or

- Add the ATT pop-up for IDFA collection so your `AppDelegate.m` will look like this:


```
-(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
[GeneratedPluginRegistrant registerWithRegistry:self];
if (@available(iOS 14, *)) {
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
//If you want to do something with the pop-up
}];
}
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
```
```
- (void)applicationDidBecomeActive:(nonnull UIApplication *)application {
if (@available(iOS 14, *)) {
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
// native code here
}];
}
}
```



Expand Down
11 changes: 11 additions & 0 deletions example/android/.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,15 @@
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<filteredResources>
<filter>
<id>1643725221956</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
11 changes: 11 additions & 0 deletions example/android/app/.project
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,15 @@
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<filteredResources>
<filter>
<id>1643725221965</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
9 changes: 6 additions & 3 deletions example/ios/Runner/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ @implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GeneratedPluginRegistrant registerWithRegistry:self];
if (@available(iOS 14, *)) {
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

- (void)applicationDidBecomeActive:(nonnull UIApplication *)application {
if (@available(iOS 14, *)) {
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
//If you want to do something with the pop-up
// native code here
}];
}
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

// Reports app open from a Universal Link for iOS 9 or above
Expand Down
4 changes: 2 additions & 2 deletions example/lib/main_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class MainPageState extends State<MainPage> {
afDevKey: DotEnv().env["DEV_KEY"],
appId: DotEnv().env["APP_ID"],
showDebug: true,
disableAdvertisingIdentifier: true
timeToWaitForATTUserAuthorization: 15
);
_appsflyerSdk = AppsflyerSdk(options);
_appsflyerSdk.onAppOpenAttribution((res) {
Expand Down Expand Up @@ -60,6 +60,7 @@ class MainPageState extends State<MainPage> {
_deepLinkData = dp.toJson();
});
});

}

@override
Expand Down Expand Up @@ -100,7 +101,6 @@ class MainPageState extends State<MainPage> {
}

Future<bool> logEvent(String eventName, Map eventValues) {
_appsflyerSdk.disableSKAdNetwork(false);
return _appsflyerSdk.logEvent(eventName, eventValues);
}

Expand Down
11 changes: 11 additions & 0 deletions ios/Classes/AppsflyerSdkPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,23 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
[self setCurrentDeviceLanguage:call result:result];
}else if([@"setSharingFilterForPartners" isEqualToString:call.method]){
[self setSharingFilterForPartners:call result:result];
}else if([@"setDisableAdvertisingIdentifiers" isEqualToString:call.method]){
[self setDisableAdvertisingIdentifiers:call result:result];
}
else{
result(FlutterMethodNotImplemented);
}
}

- (void)setDisableAdvertisingIdentifiers:(FlutterMethodCall*)call result:(FlutterResult)result{
id isAdvertiserIdEnabled = call.arguments;
if ([isAdvertiserIdEnabled isKindOfClass:[NSNumber class]]) {
BOOL _isAdvertiserIdEnabled = [isAdvertiserIdEnabled boolValue];
[[AppsFlyerLib shared] setDisableAdvertisingIdentifier: _isAdvertiserIdEnabled];
}
result(nil);
}

- (void)setSharingFilterForPartners:(FlutterMethodCall*)call result:(FlutterResult)result{
NSArray* partners = call.arguments;
[[AppsFlyerLib shared] setSharingFilterForPartners: partners];
Expand Down
2 changes: 1 addition & 1 deletion ios/appsflyer_sdk.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ AppsFlyer is the market leader in mobile advertising attribution & analytics, he
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.ios.dependency 'AppsFlyerFramework', '6.4.4'
s.ios.dependency 'AppsFlyerFramework', '6.5.2'

end
2 changes: 1 addition & 1 deletion lib/src/appsflyer_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ class AppsflyerSdk {
}

void setDisableAdvertisingIdentifiers(bool isEnabled) {
_methodChannel.invokeMethod("setDisableAdvertisingIdentifiers", { 'isSetDisableAdvertisingIdentifiersEnable': isEnabled });
_methodChannel.invokeMethod("setDisableAdvertisingIdentifiers", isEnabled);
}
void onInstallConversionData(Function callback) async {
startListening(callback as void Function(dynamic), "onInstallConversionData");
Expand Down