GithubHelp home page GithubHelp logo

appsflyersdk / appsflyer-react-native-plugin Goto Github PK

View Code? Open in Web Editor NEW
273.0 14.0 196.0 63.58 MB

AppsFlyer plugin for React Native

License: MIT License

Java 30.55% JavaScript 26.03% Objective-C 42.64% Ruby 0.78%
appsflyer sdk react-native

appsflyer-react-native-plugin's Introduction

appsflyer-react-native-plugin

License: MIT npm version Downloads

๐Ÿ›  In order for us to provide optimal support, we would kindly ask you to submit any issues to [email protected]

When submitting an issue please specify your AppsFlyer sign-up (account) email , your app ID , production steps, logs, code snippets and any additional relevant information.

  • Android AppsFlyer SDK v6.13.0
  • iOS AppsFlyer SDK v6.13.1
  • From version 6.3.0, we use xcframework for iOS platform. Then you need to use cocoapods version >= 1.10

  • From version 6.2.30, logCrossPromotionAndOpenStore api will register as af_cross_promotion instead of af_app_invites in your dashboard.
    Click on a link that was generated using generateInviteLink api will be register as af_app_invites.

  • From version 6.0.0 we have renamed the following APIs:

Old API New API
trackEvent logEvent
trackLocation logLocation
stopTracking stop
trackCrossPromotionImpression logCrossPromotionImpression
trackAndOpenStore logCrossPromotionAndOpenStore
setDeviceTrackingDisabled anonymizeUser
AppsFlyerTracker AppsFlyerLib

And removed the following ones:

  • trackAppLaunch -> no longer needed. See new init guide
  • sendDeepLinkData -> no longer needed. See new init guide
  • enableUninstallTracking -> no longer needed. See new uninstall measurement guide

If you have used 1 of the removed APIs, please check the integration guide for the updated instructions.


๐Ÿš€ Getting Started

๐Ÿ”— Deep Linking

๐Ÿงช Sample Apps

appsflyer-react-native-plugin's People

Contributors

a-sapozhnikov-sdg avatar a613 avatar af-fess avatar af-margot avatar al-af avatar amit-kremer93 avatar bang9 avatar benjaminaf avatar benlaverriere avatar dori-af avatar drop-george avatar haveamission avatar idanlevi1 avatar ifsnow avatar jorgeruvalcaba avatar jsdario avatar khorark avatar konstantinoskoulaxizis avatar kutsan avatar liaz-af avatar mewfree avatar natiad-af avatar princefishthrower avatar screamz avatar shaharaf avatar sokoloff06 avatar sonicdoe avatar southerneer avatar tamago3keran avatar wesfieldj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

appsflyer-react-native-plugin's Issues

Unique Users didn't Count on trackEvent

i have track the event like this :

appsFlyer.trackEvent("Search", {},
            (result) => {
                console.log(result);
            },
            (error) => {
                console.error(error);
            }
        )

And the event already recorded in appsflyer dashboard, but the unique users didn't count.
is there anything should i add in the code to handle that?

screen shot 2018-06-05 at 11 16 56

initSdk undefined/can't link

Hi,
I've successfully installed AppsFlyer pod and npm package, but I keep getting this when running react-native link:
rnpm-install ERR! It seems something went wrong while linking. Error: Expected "{" but "/" found.

For now, without linking, I'm unable to initialize the sdk. First, I get this:
image

And then, if I try to track any event, this:
image

Is there any step missing in the readme? How should I proceed?

Missing Organic/Non-organic Users

There are other issues reported, but were closed without a proper solution.
As for today, using the latest available version 1.3.2 we're unable to get most of our users reported as Users in AppsFlyer on Android devices, regardless if SDK Integration Test is used or not. Whitelisted or not. Simulators or real devices.
This used to work fine on iOS.

Our approach for the moment is to implement Java/Android SDK and write our own Native Module to consume from Javascript (Basically, our own version of react-native-appsflyer)

Android SDK Integration Test app fails

I'm consistently getting failures in the Android SDK integration test

img_0016

  1. I'm using version v1.2.13 (latest)
  2. BroadcasterReceiver is configured correctly
  3. This point is not relevant to react-native apps and there is no documentation to suggest this is required.

@af-fess can you please help?

Can not set custom params while generating onelink using generateInviteLink method.

static generateInviteLink () {
var inviteOptions = {
channel: 'gmail',
campaign: 'myCampaign',
customerID: '1234',
userParams: {
myParam: 'newUser',
anotherParam: 'fromWeb',
amount: 1
}
}
var onInviteLinkSuccess = function (link) {
console.log('the appsflyer link is', link) // Handle Generated Link Here
}
function onInviteLinkError (err) {
console.log(err)
}
AppsFlyer.generateInviteLink(
inviteOptions,
onInviteLinkSuccess,
onInviteLinkError
)
}

when i use oninstallconversiondata function to get install conversion data then i don't receive custom params. Any help would be appreciated. Thanks in advance.

initSdk: undefined error on iOS

I have already looked at #3, but this does not fix my issue.

I have followed the read me steps:

  • yarn add react-native-appsflyer --save
  • pod file:
use_frameworks!
project 'ios/SportEventApp.xcodeproj'

target 'SportEventApp' do
  pod 'AppsFlyerFramework'
end
  • pod install --verbose
  • Add NAppsFlyer.xcodeproj to libraries in xcode
  • Add libRNAppsFlyer.a to Link binaries with libraries

At this stage the project didn't build. I got an error: linker command failed with exit code 1 (use -v to see invocation) pointing to the Pods_SportEventApp.framework file in Linked binaries with libraries.

I found this solution which said to remove the Pods_SportEventApp.framework from Linked binaries with libraries.

The app now runs fine on both iOS simulator and iOS device, but in the console log I get:

initSdk: undefined

I am using:

  • AppsFlyerFramework 4.6.1
  • react-native-cli: 1.0.0
  • react-native: 0.37.0
  • Xcode Version 8.2.1

Here are all of my Linked Framework and Libraries:
screen shot 2017-01-09 at 16 57 56

Where is android methods in this wrapper?

Checking the code to integrate the wrapper to SDK, I saw that there is almost nothing for the android:

/**
 * iOS only
 */

appsFlyer.trackAppLaunch = () => {
    return RNAppsFlyer.trackAppLaunch();
}

appsFlyer.trackLocation = (longitude, latitude, callback) => {
    return RNAppsFlyer.trackLocation(longitude, latitude, callback);
};

appsFlyer.trackEvent = (eventName, eventValues, successC, errorC) => {
    return RNAppsFlyer.trackEvent(eventName, eventValues, successC, errorC);
};

appsFlyer.setUserEmails = (options, successC, errorC) => {
    return RNAppsFlyer.setUserEmails(options, successC, errorC);
};

appsFlyer.getAppsFlyerUID = (callback) => {
    return RNAppsFlyer.getAppsFlyerUID(callback);
};

appsFlyer.sendDeepLinkData = (callback) => {
    return RNAppsFlyer.sendDeepLinkData(callback);
};

How can I track events, app installs/uninstalls, etc.. in android?

Also when I try to track a Event I receive this:

screenshot_1541784639

Every installation is tracked as organic

We're trying to implement the collection of the installs by Facebook. Anyway, seems that all they are being count as Organic installations.

We read this article As this guide says https://support.appsflyer.com/hc/en-us/articles/207033826-Facebook-Ads-Setup-Guide#Integration which says this: "Your app MUST collect IDFA or GAID or all your Facebook installs are attributed as organic. For further information refer to the SDK Integrations Guides for either iOS or Android."

Anyway, you don't have any information in your readme about this.

How can we count the facebook installs? Any solution?

Thanks,

react-native link

Hi, would it be possible to add the react-native link CLI to this project?

Unable to see any Non-Organic installs

Hi,

Have integrated SDK, made the app on appsflyer, and have tried it with 9Apps Channel for non-organic installs, but unable to see any of them.

Please help

onInstallConversionData dosen't return onAppOpenAttribution when mounting

I get a success callback from onInstallConversionData every time opening the app. I can get both callbacks of type onInstallConversionDataLoaded and onAppOpenAttribution.
But I don't get the onAppOpenAttribution when mounting the app for the first time even if I pressed a referal-link.
If I have the app running in background and pressing the referallink I get an onAppOpenAttribution callback. If I open the app with the link and then open it from the background I get the onAppOpenAttribution when opening from background.

Do you now if this is how it suppose to be?

initSdk is too slow

We want to log af_app_in event, but it seems that initSdk is not complete before the first componentDidMount(). Is there any way we can make this method synchronously?

Integration test only works if the app is already running in the background

Hi,

We are encountering some unusual behaviour and I'm hoping you can help. The problem we are having is that when using the integration testing app, it always fails on the first attempt. However, it works if my app is already running in the background. I'm not sure why this is happening and don't know if it will work in production or not (we have not released it yet).

Here are the things we did to set it up:

  • Add compile project(path: ':react-native-appsflyer') to android/app/build.gradle
  • Add the SingleInstallBroadcastReceiver to the AndroidManifest.xml
  • Add the @integer/google_play_services_version meta attribute to the AndroidManifest.xml
  • Add the import and RNAppsFlyerPackage package to MainApplication.java
  • Include and set project dir in android/settings.gradle
  • Call initSdk with our config (also call getAppsFlyerUID)
  • Whitelist my device (it appears in the list)

Description of the issue:

  • Running the "SDK Integration Test" from the provided integration testing app from the Google Play Store fails on the first attempt
    • Our AppsFlyer dashboard shows a click but no install
    • The integration testing app says there is a problem (the generic "This app can not be monitored." message)
  • If you clear the app in the background (open app switcher, swipe it away) then the problem will repeat itself
  • However, if you don't clear it and re-run the integration test again then it succeeds!
    • It successfully registers as both a click and non-organic install in the dashboard
    • Re-running it will continue to work until the app is cleared in the background
    • It also succeeds if the first launch was from manually opening the app rather than the integration testing app opening it

Other information that might be of use:

  • I'm using a Nexus 6P
  • I also tested it on an older HTC One and get the exact same behaviour
  • onInstallConversionData appears to never call its callback in either the successful or unsuccessful case
  • The logs say that neither the Android ID nor IMEI are being tracked
    • I thought that was the issue for a while and tried to manually set the Android ID but that doesn't fix anything
  • I tried running them demo app and everything shows as "not initialized yet"/"not called yet"
    • There appear to be no relevant logs either
    • The integration testing app also does not work with it (and also complains about the missing intent stuff)

Do you know what's going on? I am very happy to provide more details or logs or try anything you can suggest.

Thanks,
David

trackAppLaunch is called during initSDK.

Hey,

initSDK tracks app launch, in my scenario I want to set customerID and other properties before app launch is tracked.
Can you separate trackAppLaunch into a separate call. So it can be called explicitly?

Thanks

Alex

AppsFlyer Crash

We're using the latest RN AppsFlyer with 4.6.3 and are seeing this crash. This is hard to debug since AppsFlyer is one of the first parts of the app that gets turned on for attribution.

Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x186e8d1b8 __exceptionPreprocess
1 libobjc.A.dylib 0x1858c455c objc_exception_throw
2 CoreFoundation 0x186e8d100 -[NSException initWithCoder:]
3 Foundation 0x187a27f80 _writeJSONValue
4 Foundation 0x187a2a0d8 ___writeJSONObject_block_invoke
5 CoreFoundation 0x186dd3548 __65-[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke
6 CoreFoundation 0x186dc13fc -[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:]
7 Foundation 0x187a29864 _writeJSONObject
8 Foundation 0x187a27e4c _writeJSONValue
9 Foundation 0x187a27c7c -[_NSJSONWriter dataWithRootObject:options:error:]
10 Foundation 0x187a28cc0 +[NSJSONSerialization dataWithJSONObject:options:error:]
11 Forward 0x1000a8ec8 -[RNAppsFlyer handleCallback:]
12 Foundation 0x1879a1048 __NSThreadPerformPerform
13 CoreFoundation 0x186e3ab5c CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
14 CoreFoundation 0x186e3a4a4 __CFRunLoopDoSources0
15 CoreFoundation 0x186e380a4 __CFRunLoopRun
16 CoreFoundation 0x186d662b8 CFRunLoopRunSpecific
17 GraphicsServices 0x18881a198 GSEventRunModal
18 UIKit 0x18cdad7fc -[UIApplication _run]
19 UIKit 0x18cda8534 UIApplicationMain
20 Forward 0x100051b50 main (main.m:16)
21 libdispatch.dylib 0x185d495b8 (Missing)

iOS Pod file requires manual link to React pod in node_modules

After following your iOS install directions. I kept getting a warning when installing the pod: [!] React has been deprecated. This also led to build issues in the React Native packager:

Ambiguous resolution: module ".../index.js" tries to require 'react-native', but there are several files providing this module. You can delete or fix them:

.../MyProject/ios/Pods/React/package.json

.../MyProject/node_modules/react-native/package.json

I got around the issue by manually linking the React pod to the node_modules directory so that it wasn't downloaded by the AppsFlyer pod.

pod 'React', :path => '../node_modules/react-native', :subspecs => [
  'Core',
  'DevSupport'
]
pod 'react-native-appsflyer', :path => '../node_modules/react-native-appsflyer'

post_install do |installer|
   installer.pods_project.targets.each do |target|
      # It also wouldn't work without this
      if target.name == "React"
        target.remove_from_project
      end
   end
end

Do you guys need the React dependency in the podspec file given that this already is a react native project?

Simpler Android instructions

I am not sure which version of react-native this begins at, but simply running 'react-native link react-native-appsflyer' (or just react-native link) once react-native-appsflyer has been added to the npm dependencies takes care of all Android steps that have been specified.

I can look into version specific info later and PR this myself sometime soon, if needed.

EDIT: apologies, just saw the older issue sort-of related to this

Android now requires ACCESS_WIFI_STATE permission

I integrated the React Native SDK into my app and now our Android app requires an additional permission to read "Wi-Fi Connection information" since your library adds the android.permission.ACCESS_WIFI_STATE to our final manifest.

Why is this permission needed and automatically included?

Error on calling trackEvent

After initializing the sdk, call like this

const eventValues = {
	af_content_id: 'id123',
	af_currency: 'USD',
	af_revenue: '2',
};
appsFlyer.trackEvent('af_add_to_cart', eventValues);

Then it will throw error
whatsapp image 2018-12-06 at 5 07 41 pm

Cannot compile on iOS

I have linked the library product on Build Phases as specified, and done this many times before with other libs, but I am unable to surpass the following:

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_AppsFlyerTracker", referenced from:
      objc-class-ref in RNAppsFlyer-BA59A0E70988396B.o

Everything seems to be working right. I just added the code needed to follow uninstalls per user.

(RCTResponseSenderBlock) of RNAppsFlyer.initSdk must not be null

I trying install package but when initSdk, i received 2 problems

(RCTResponseSenderBlock) of RNAppsFlyer.initSdk must not be null
Argument 1 (<null>) of RNAppsFlyer.initSdk could not be processed. Aborting method call.

my pods

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

pre_install do |installer|
      Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
  end

target 'cralerts' do
    pod 'React', subspecs: [
        'Core',
        'CxxBridge',
        'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
        'RCTImage',
        'RCTLinkingIOS',
        'RCTAnimation',
        'RCTNetwork',
        'RCTText',
        'RCTSettings',
        'RCTActionSheet',
        'RCTVibration',
        'RCTPushNotification',
        'RCTWebSocket' # needed for debugging
      ], path: '../node_modules/react-native'

      # Explicitly include Yoga if you are using RN >= 0.42.0
      pod 'yoga', path: '../node_modules/react-native/ReactCommon/yoga'
      pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
      pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
      pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

      pod 'react-native-appsflyer',:path => '../node_modules/react-native-appsflyer'

    target 'cralertsTests' do
      inherit! :search_paths
      # Pods for testing
    end

end

my dependence

"react": "16.3.1",
"react-native": "0.55.4",
"react-native-appsflyer": "^1.2.12",

setGCMProjectID is not a function

Hi. I got these message. what happen?

Possible Unhandled Promise Rejection (id: 0): TypeError: _reactNativeAppsflyer.default.setGCMProjectID is not a function TypeError: _reactNativeAppsflyer.default.setGCMProjectID is not a function

Here's my Code

componentDidMount = async() => {
  let fcmToken = await getValue(Keys.TOKEN);
  if (!fcmToken) {
    fcmToken = await firebase.messaging().getToken();
    if (fcmToken) {
      setValue(Keys.TOKEN, fcmToken);
      ChannelIO.initPushToken(fcmToken);
      appsFlyer.setGCMProjectID(fcmToken,
        (gcmProjectID) => {
        },
        (error) => {
        })
    }
  }
}

customerId is not sent to PUSH API

Hey,

I'm setting customerId in my app, but when our server side receives a PUSH call, with installation details it does not contain the customerId I set.

Thanks

use_frameworks! doesnt work

[!] The 'Pods-mobileappb2c' target has transitive dependencies that include static binaries: (/Users/yogi/Documents/app/ios/Pods/AppsFlyerFramework/AppsFlyerLib.framework)

uninstall tracking not working

Hi !
I tried implementing the uninstall tracking by reading the README but can't check it with the test flight.
Is there any mistake in this method?

version

react-native-appsflyer: 1.4.1
react-native: 0.57.8

appdelegate.m

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
  [[AppsFlyerTracker sharedTracker] registerUninstall:deviceToken];
}

import <AppsFlyerLib/AppsFlyerTracker.h> error.

Hi. Thank you for your work.

I manually linked as RN documents say (I failed to install with cocoapods which install React 0.11 etc)
It's fine with one error. I added header search path, and edited as follows.

#import <AppsFlyerLib/AppsFlyerTracker.h> // Error #import "AppsFlyerTracker.h" // It's ok.

Is 'import "filename"' the right way?

onAppOpenAttribution not working for deferred links

When the app is already installed I get a succesful callback from onAppOpenAtrtribution method but if I do the test mentioned here there's no callback: https://support.appsflyer.com/hc/en-us/articles/208874366-OneLink-Deep-Linking-Guide#urls-testing-testing-deferred-deep-linking-for-scheme-uris. Which basically consists on uninstalling the app click the deep link and launch the app from the simulator.

DeepLink: https://goin.onelink.me/xcGq/1977c4de
react-native-appsflyer: 1.4.1
react-native: 0.55.4

'React/RCTDefines.h' file not found

image

React 0.55.4

Podfile

target 'Busfor' do
  pod 'React', subspecs: [
    'Core',
    'CxxBridge',
    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
    'RCTImage',
    'RCTLinkingIOS',
    'RCTAnimation',
    'RCTNetwork',
    'RCTText',
    'RCTSettings',
    'RCTActionSheet',
    'RCTVibration',
    'RCTPushNotification',
    'RCTWebSocket' # needed for debugging
  ], path: '../node_modules/react-native'

  # Explicitly include Yoga if you are using RN >= 0.42.0
  pod 'yoga', path: '../node_modules/react-native/ReactCommon/yoga'
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  pod 'react-native-blur', path: '../node_modules/react-native-blur'
  pod 'BugsnagReactNative', path: '../node_modules/bugsnag-react-native'
  pod 'RNI18n', path: '../node_modules/react-native-i18n'
  pod 'RNDeviceInfo', path: '../node_modules/react-native-device-info'
  pod 'pushwoosh-react-native-plugin', path: '../node_modules/pushwoosh-react-native-plugin'
  pod 'react-native-splash-screen', path: '../node_modules/react-native-splash-screen'
  pod 'Fabric'
  pod 'Crashlytics'
  pod 'react-native-appsflyer', path: '../node_modules/react-native-appsflyer'
  pod 'react-native-google-analytics-bridge', path: '../node_modules/react-native-google-analytics-bridge'
  pod 'Mixpanel'
end

When I turn on use_frameworks! I got

The 'Pods-Busfor' target has transitive dependencies that include static binaries: (/Users/stereodenis/work/busfor-app/ios/Pods/AppsFlyerFramework/AppsFlyerLib.framework)

Update iOS and Android SDKs to comply with GDPR

I received an email from Appsflyer telling me to update the iOS and Android SDKs but seems like the integration with react native is not updated, please update it as soon as possible.

Thanks!

is onAppOpenAttribution before AppsFlyer init intentional?

Basically I have an issue where I am initializing the AppsFlyer SDK at app start to gather analytics from the user, which works great but the issue is that when I want to listen to deep links/deferred deep links an error is thrown.

You attempted to set the key `onInstallConversionDataListener` with the value `true` on an object that is meant to be immutable and has been frozen.

Which I understand that you're suppose to use onAppOpenAttribution before appsFlyer.initSdk. This approach seems backwards to me Is this expected behavior? Or am I misusing the library?

So the problem is, how am I suppose to listen to deep links using OneLinks AND gather analytics at the start of my app launching?

App crashed because AndroidManifest.xml contains Google Analytics receiver, which is not on classpath

Hey,

I'm experiencing a crash, when receiving INSTALL_REFERRER intent.

12-05 14:12:35.079 16995 16995 E AndroidRuntime: java.lang.RuntimeException: 
Unable to instantiate receiver com.google.android.apps.analytics.AnalyticsReceiver: java.lang.ClassNotFoundException: Didn't find class "com.google.android.apps.analytics.AnalyticsReceiver" on path: DexPathList[[zip file "/data/app/com.wondermall.prod-1/base.apk"],nativeLibraryDirectories=[/data/app/com.wondermall.prod-1/lib/arm, /system/fake-libs, /data/app/com.wondermall.prod-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
12-05 14:12:35.079 16995 16995 E AndroidRuntime: 	at android.app.ActivityThread.handleReceiver(ActivityThread.java:2995)
12-05 14:12:35.079 16995 16995 E AndroidRuntime: 	at android.app.ActivityThread.-wrap18(ActivityThread.java)
12-05 14:12:35.079 16995 16995 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
12-05 14:12:35.079 16995 16995 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:102)
12-05 14:12:35.079 16995 16995 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:154)
12-05 14:12:35.079 16995 16995 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6088)
12-05 14:12:35.079 16995 16995 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
12-05 14:12:35.079 16995 16995 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
12-05 14:12:35.079 16995 16995 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
12-05 14:12:35.079 16995 16995 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.apps.analytics.AnalyticsReceiver" on path: DexPathList[[zip file "/data/app/com.wondermall.prod-1/base.apk"],nativeLibraryDirectories=[/data/app/com.wondermall.prod-1/lib/arm, /system/fake-libs, /data/app/com.wondermall.prod-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
12-05 14:12:35.079 16995 16995 E AndroidRuntime: 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
12-05 14:12:35.079 16995 16995 E AndroidRuntime: 	at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
12-05 14:12:35.079 16995 16995 E AndroidRuntime: 	at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
12-05 14:12:35.079 16995 16995 E AndroidRuntime: 	at android.app.ActivityThread.handleReceiver(ActivityThread.java:2990)
12-05 14:12:35.079 16995 16995 E AndroidRuntime: 	... 8 more

The SDK's AndroidManifest.xml contains two receivers:

        <receiver android:name="com.google.android.apps.analytics.AnalyticsReceiver" android:exported="true">
            <intent-filter>
                <action android:name="com.android.vending.INSTALL_REFERRER" />
            </intent-filter>
        </receiver>
        <receiver android:name="com.admob.android.ads.analytics.InstallReceiver" android:exported="true">
            <intent-filter>
                <action android:name="com.android.vending.INSTALL_REFERRER" />
            </intent-filter>
        </receiver>

One of them is not part of my app dependencies, this causes the crash.
Do you need those receivers? Can they be removed?

Thanks

Alex

number of uninstall & Install events is different from the google play console

Hello, I have implemented react-native-appsflyer on my project, but when I checked the google play console, it had different number of uninstall & install events.

number of uninstall events from Appsflyer (Dec 10, 2018 - Dec 11, 2018) : 3
screen shot 2018-12-20 at 14 14 13

number of Install events from Appsflyer
Dec 10, 2018 : 656
Dec 11, 2018 : 620
screen shot 2018-12-20 at 14 24 32

number of Install & Uninstall events from google play console :
Install events (Dec 10, 2018) : 247
Install events (Dec 11, 2018) : 241
Uninstall events (Dec 10, 2018) : 181
Uninstall events (Dec 11, 2018) : 196

screen shot 2018-12-20 at 14 22 31

This is my code :

 constructor(props: Props) {
    super(props);

    this.initSdk(() => {
      this.enableUninstallTracking();
    });
  }

  initSdk = (onSuccess: Function) => {
    const options = {
      devKey: 'xxxx,
      isDebug: false,
      appId: '',
    };

    if (Platform.OS === 'ios') {
      options.appId = 'xxx';
    }

    appsFlyer.initSdk(
      options,
      result => {
        if (onSuccess) onSuccess(result);
      },
      () => {}
    );
  };

  enableUninstallTracking = () => {
    if (Platform.OS === 'android') {
      const gcmProjectNum = 'xxxx';
      appsFlyer.enableUninstallTracking(gcmProjectNum, () => {});
    }
  };

is there something wrong with my code ?

Build Issues on 1.2.6+

We're trying to upgrade this library from 1.2.2 and have hit a roadblock.

1.2.4 updates fine, but 1.2.6 and above do not build.

We're on react-native 0.57.3 with the following gradle variables:

    buildToolsVersion = "27.0.3"
    minSdkVersion = 16
    compileSdkVersion = 27
    targetSdkVersion = 26

Any guidance would be much appreciated, as I've done a lot of searching without any luck. Only resolution has been to drop back down the version for the time-being.

We get the following output:

:app:compileAlphaReleaseRenderscript
:app:checkAlphaReleaseManifest
:app:generateAlphaReleaseBuildConfig
:app:prepareLintJar
:app:mainApkListPersistenceAlphaRelease
:app:bundleAlphaReleaseJsAndAssets
warning: the transform cache was reset.
fs.js:1385
    throw error;
    ^

Error: watch /builds/{redacted}/App/{redacted-AppName}/node_modules/react-native-appsflyer/examples/demo/android/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/25.3.1/res/values-bn-rBD ENOSPC
    at _errnoException (util.js:1021:11)
    at FSWatcher.start (fs.js:1383:19)
    at Object.fs.watch (fs.js:1409:11)
    at NodeWatcher.watchdir (/builds/{redacted}/App/{redacted-AppName}/node_modules/metro/node_modules/sane/src/node_watcher.js:159:22)
    at Walker.<anonymous> (/builds/{redacted}/App/{redacted-AppName}/node_modules/metro/node_modules/sane/src/common.js:109:31)
    at emitTwo (events.js:125:13)
    at Walker.emit (events.js:213:7)
    at /builds/{redacted}/App/{redacted-AppName}/node_modules/walker/lib/walker.js:69:16
    at go$readdir$cb (/builds/{redacted}/App/{redacted-AppName}/node_modules/graceful-fs/graceful-fs.js:162:14)
    at FSReqWrap.oncomplete (fs.js:136:15)
:app:bundleAlphaReleaseJsAndAssets FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:bundleAlphaReleaseJsAndAssets'.
> Process 'command 'node'' finished with non-zero exit value 1

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:bundleAlphaReleaseJsAndAssets'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
	at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
	at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
	at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.process.internal.ExecException: Process 'command 'node'' finished with non-zero exit value 1
	at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:382)
	at org.gradle.process.internal.DefaultExecAction.execute(DefaultExecAction.java:31)
	at org.gradle.api.tasks.AbstractExecTask.exec(AbstractExecTask.java:54)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
	at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:780)
	at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:747)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
	... 29 more

Exponent

Would be great if this could be added to Exponent.

How do I use deep link with linking and appsflyer?

Hi @af-fess ,
I'm want to use deep link from app A to from app B. But app A has installed react-native-appsflyer library. When I config deep link XCode with code

- (BOOL)application:(UIApplication *)application
   openURL:(NSURL *)url
   options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
  return [RCTLinkingManager application:application openURL:url options:options];
} 
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity
 restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
{
 return [RCTLinkingManager application:application
                  continueUserActivity:userActivity
                    restorationHandler:restorationHandler];
}

then XCode show error Duplicate declaration of method 'application:openURL:options:'. Beacause after I have installed react-native-appsflyer library.

// Reports app open from deep link from apps which do not support Universal Links (Twitter) and for iOS8 and below
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation {
    [[AppsFlyerTracker sharedTracker] handleOpenURL:url sourceApplication:sourceApplication withAnnotation:annotation];
    return YES;
}

// Reports app open from URL Scheme deep link for iOS 10
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
            options:(NSDictionary *) options {
    [[AppsFlyerTracker sharedTracker] handleOpenUrl:url options:options];
    return YES;
}

Can you help me? @af-fess

Android Install Event

I have followed the installation instructions, and I am seeing install events for iOS but not for Android. Google Play Services have been added also, but I am unsure if they are needed or not.

Is there something that I have missed? I am not seeing an error when initialising the SDK, I am seeing the success callback.


android/settings.gradle

include ':react-native-appsflyer'
project(':react-native-appsflyer').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-appsflyer/android')

android/app/build.gradle

dependencies {
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile 'com.google.android.gms:play-services-ads:9.6.+'
    compile 'com.google.android.gms:play-services-identity:9.6.+'
    ...
    compile project(':react-native-appsflyer')
}

MainApplication.Java

import com.appsflyer.reactnative.RNAppsFlyerPackage;

public class MainApplication extends Application implements ReactApplication {

  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
        new MainReactPackage(),
        new RNAppsFlyerPackage(MainApplication.this)
      );
    }

  };
  
}

AndroidManifest.xml

<manifest>

  ...

  <application>

    ...

    <receiver android:name="com.appsflyer.MultipleInstallBroadcastReceiver" android:exported="true">
      <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
      </intent-filter>
    </receiver>

    ...

    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

  </application>

  ...

</mainfest>

index.js

import appsFlyer from 'react-native-appsflyer';

const appsFlyerOptions = {
    devKey: "xxx",
    appId: "xxx"
};

class App extends Component {

  componentDidMount() {
    appsFlyer.initSdk(appsFlyerOptions,
      (result) => { console.log('Result:', result) },
      (error) => { console.error('Error:', error) }
    );
  }

  componentWillUnmount() {
    if(this.onInstallConversionDataCanceller){
      this.onInstallConversionDataCanceller();
    }
  }

  onInstallConversionDataCanceller = () => {
    appsFlyer.onInstallConversionData((data) => { console.log(data) })
  }

}

Building error on v1.3.2

Error message

Task :app:compileDebugJavaWithJavac FAILED
path-to-project/android/app/src/main/java/com/**/**/MainApplication.java:67: error: constructor RNAppsFlyerPackage in class RNAppsFlyerPackage cannot be applied to given types;
            new RNAppsFlyerPackage(MainApplication.this),
            ^
  required: no arguments
  found: MainApplication
  reason: actual and formal argument lists differ in length
Note: path-to-project/android/app/src/main/java/com/**/**/MainApplication.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error

Error version

Upgrade from 1.3.1 to 1.3.2

trackEvent crashes when empty properties passed

Hey,

When calling AppsFlyer.trackEvent('login') or AppsFlyer.trackEvent('login', {}) it fails with NPE.
In order to make it work, the properties have to contain at least one value.

Alex

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.