Socket
Book a DemoInstallSign in
Socket

capacitor-appsflyer

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

capacitor-appsflyer

Appsflyer capacitor plugin

1.1.2
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Capacitor AppsFlyer plugin for Android and iOS

Currently only works on ios, but android support will be coming soon

Available methods:

  • setCurrencyCode()
  • setСustomerUserID()
  • anonymizeUser()
  • setIsStopped()
  • getAppsFlyerUID()
  • logEvent()
  • getSdkVersion()
  • setAppInviteOneLinkID()
  • generateInviteLink()
  • logCrossPromotionImpression()
  • logCrossPromotionAndOpenStore()
  • setSharingFilter()
  • setSharingFilterForAllPartners()
  • disableCollectASA()
  • setDisableAdvertisingIdentifier()
  • setOneLinkCustomDomains()
  • enableFacebookDeferredApplinks()
  • setPhoneNumber()
  • setUserEmails()
  • validateAndLogInAppPurchase()
  • setUseReceiptValidationSandbox()
  • setHost()
  • addPushNotificationDeepLinkPath()
  • setResolveDeepLinkURLs()
  • disableSKAD()

Usage example:

  • In AppDelegate.swift (usually ios/App/App/AppDelegate.swift)
...
import AppsFlyerLib

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
  var window: UIWindow?

...

  func applicationDidBecomeActive(_: UIApplication) {
    Appsflyer.shared.applicationDidBecomeActive()
  }

...

  func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
    ...
	Appsflyer.shared.application(open: url, options: options)
    ...
  }

...

  func application(_: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
   	...
    Appsflyer.shared.application(continue: userActivity, restorationHandler: restorationHandler)
    ...
	}

...

  func application(_: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
    Appsflyer.shared.application(didReceiveRemoteNotification: userInfo)
  }

...

  func application(_: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
   ...
    Appsflyer.shared.application(didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
   ...
  }

...
}

  • In your module (e.g. app.module.ts)
...
import { Appsflyer } from 'capacitor-appsflyer'

@NgModule({
	...
	providers: [
		...
		Appsflyer,
	],
})
export class AppModule {}

  • In your main component (e.g. app.component.ts)
...
import { Appsflyer } from 'capacitor-appsflyer'

@Component()
export class AppComponent {
	constructor(private appsflyer: Appsflyer) {
        this.platform
			.ready()
			.then(() => {
                this.appsflyer.addListener('onConversionDataSuccess', (data) => {
					console.log('AppsflyerPlugin onConversionDataSuccess', data)
				})
            })
    }
}

BREAKING CHANGES in 1.x.x version

  • AppsFlyer proxy-class has been removed.

    Migrate:

    In ios/App/App/AppDelegate.swift, update the following:

func applicationDidBecomeActive(_: UIApplication) {
-    Appsflyer.shared.applicationDidBecomeActive()
+    AppsFlyerLib.shared().start()
}

  func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
-     Appsflyer.shared.application(open: url, options: options)
+     AppsFlyerLib.shared().handleOpen(url, options: options)

      return ApplicationDelegateProxy.shared.application(app, open: url, options: options)
  }


  func application(_ app: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
-   Appsflyer.shared.application(continue: userActivity, restorationHandler: restorationHandler)
+   AppsFlyerLib.shared().continue(userActivity, restorationHandler: nil)

    return ApplicationDelegateProxy.shared.application(app, continue: userActivity, restorationHandler: restorationHandler)
  }

  func application(_: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
-      Appsflyer.shared.application(didReceiveRemoteNotification: userInfo)
+      AppsFlyerLib.shared().handlePushNotification(userInfo)
  }

    func application(_: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)
    {
-    Appsflyer.shared.application(didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
+   AppsFlyerLib.shared().registerUninstall(deviceToken)
    NotificationCenter.default.post(name: .capacitorDidRegisterForRemoteNotifications, object: deviceToken)
  }
  • Added full support for Capacitor 3 and removed compatibility with Capacitor 2

// TODO docs

Keywords

capacitor

FAQs

Package last updated on 02 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.