Code Monkey home page Code Monkey logo

react_native_sdk's Introduction

Summary

This is the React Native SDK of Adjust™. You can read more about Adjust™ at adjust.com.

Table of contents

Example app

There is an example app inside the example directory.

Basic integration

We will describe the steps to integrate the Adjust SDK into your React Native project. You can use any text editor or IDE for React Native development. There are no assumptions made regarding development environment.

Get the SDK

First, download the library from npm:

$ npm install react-native-adjust --save

For iOS app make sure to go to ios folder and install Cocoapods dependencies:

$ cd ios && pod install

After this Adjust SDK should be successfully added to your app.

Integrate the SDK into your app

You should use the following import statement on top of your .js file

import { Adjust, AdjustEvent, AdjustConfig } from 'react-native-adjust';

In your App.js file, add the following code to initialize the Adjust SDK:

constructor(props) {
    super(props);
    const adjustConfig = new AdjustConfig("{YourAppToken}", AdjustConfig.EnvironmentSandbox);
    Adjust.create(adjustConfig);
}

componentWillUnmount() {
  Adjust.componentWillUnmount();
}

Replace {YourAppToken} with your app token. You can find this in your Adjust dashboard.

Depending on whether you build your app for testing or for production, you must set the environment with one of these values:

AdjustConfig.EnvironmentSandbox
AdjustConfig.EnvironmentProduction

Important: This value should be set to AdjustConfig.EnvironmentSandbox if and only if you or someone else is testing your app. Make sure to set the environment to AdjustConfig.EnvironmentProduction just before you publish the app. Set it back to AdjustConfig.EnvironmentSandbox when you start developing and testing it again.

We use this environment to distinguish between real traffic and test traffic from test devices. It is very important that you keep this value meaningful at all times!

Adjust logging

You can increase or decrease the amount of logs you see in tests by calling setLogLevel on your AdjustConfig instance with one of the following parameters:

adjustConfig.setLogLevel(AdjustConfig.LogLevelVerbose);   // enable all logging
adjustConfig.setLogLevel(AdjustConfig.LogLevelDebug);     // enable more logging
adjustConfig.setLogLevel(AdjustConfig.LogLevelInfo);      // the default
adjustConfig.setLogLevel(AdjustConfig.LogLevelWarn);      // disable info logging
adjustConfig.setLogLevel(AdjustConfig.LogLevelError);     // disable warnings as well
adjustConfig.setLogLevel(AdjustConfig.LogLevelAssert);    // disable errors as well
adjustConfig.setLogLevel(AdjustConfig.LogLevelSuppress);  // disable all logging

Adjust project settings

Once the Adjust SDK has been added to your app, certain tweaks are going to be performed so that the Adjust SDK can work properly. Below you can find a description of every additional thing that the Adjust SDK performs after you've added it to your app and what needs to be done by you in order for Adjust SDK to work properly.

Android permissions

The Adjust SDK by default adds two permissions to your app's AndroidManifest.xml file:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

The INTERNET permission might be needed by our SDK at any point in time. The ACCESS_NETWORK_STATE permission is needed for reading type of network device is connected to.

Add permission to gather Google advertising ID

If you are targeting Android 12 and above (API level 31), you need to add the com.google.android.gms.AD_ID permission to read the device's advertising ID. This will be done automatically by the Adjust SDK for you:

<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>

For more information, see Google's AdvertisingIdClient.Info documentation.

In case you don't want this permission to be part of your app, you can remove it by adding following line to your AndroidManifest.xml file:

<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>

Google Play Services

Since August 1, 2014, apps in the Google Play Store must use the Google Advertising ID to uniquely identify devices. To allow the Adjust SDK to use the Google Advertising ID, you must integrate Google Play Services.

In order to do this, open your app's build.gradle file and find the dependencies block. Add the following line:

implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'

Note: The version of the Google Play Services library that you're using is not relevant to the Adjust SDK, as long as the analytics part of the library is present in your app. In the example above, we just used the most recent version of the library at the time of writing.

To check whether the analytics part of the Google Play Services library has been successfully added to your app so that the Adjust SDK can read it properly, you should start your app by configuring the SDK to run in sandbox mode and set the log level to verbose. After that, track a session or some events in your app and observe the list of parameters in the verbose logs which are being read once the session or event has been tracked. If you see a parameter called gps_adid in there, you have successfully added the analytics part of the Google Play Services library to your app and our SDK is reading the necessary information from it.

In case you encounter any issue with attempts to read Google Advertising Identifier, feel free to open an issue in our Github repository or write an email to [email protected].

Proguard settings

If you are using Proguard, add these lines to your Proguard file:

-keep class com.adjust.sdk.** { *; }
-keep class com.google.android.gms.common.ConnectionResult {
    int SUCCESS;
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
    com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
    java.lang.String getId();
    boolean isLimitAdTrackingEnabled();
}
-keep public class com.android.installreferrer.** { *; }

Install referrer

In order to correctly attribute an install of your Android app to its source, Adjust needs information about the install referrer. This can be obtained by using the Google Play Referrer API or by catching the Google Play Store intent with a broadcast receiver.

Important: The Google Play Referrer API is newly introduced by Google with the express purpose of providing a more reliable and secure way of obtaining install referrer information and to aid attribution providers in the fight against click injection. It is strongly advised that you support this in your application. The Google Play Store intent is a less secure way of obtaining install referrer information. It will continue to exist in parallel with the new Google Play Referrer API temporarily, but it is set to be deprecated in future.

Google Play Referrer API

In order to support this, add the following line to your app's build.gradle file:

compile 'com.android.installreferrer:installreferrer:2.2'

installreferrer library is part of Google Maven repository, so in order to be able to build your app, you need to add Google Maven repository to your app's build.gradle file if you haven't added it already:

allprojects {
    repositories {
        maven {
            url "https://maven.google.com"
        }
    }
}

Also, make sure that you have paid attention to the Proguard settings chapter and that you have added all the rules mentioned in it, especially the one needed for this feature:

-keep public class com.android.installreferrer.** { *; }

This feature is supported if you are using the Adjust SDK v4.12.0 or above.

Google Play Store intent

The Google Play Store INSTALL_REFERRER intent should be captured with a broadcast receiver. The Adjust install referrer broadcast receiver is added to your app by default. For more information, you can check our native Android SDK README. You can see this in the AndroidManifest.xml file which is part of our React Native plugin:

<receiver android:name="com.adjust.sdk.AdjustReferrerReceiver" 
          android:exported="true" >
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
</receiver>

Please bear in mind that, if you are using your own broadcast receiver which handles the INSTALL_REFERRER intent, you don't need to add the Adjust broadcast receiver to your manifest file. You can remove it, but inside your own receiver add the call to the Adjust broadcast receiver as described in our Android guide.

Huawei Referrer API

As of v4.22.0, the Adjust SDK supports install tracking on Huawei devices with Huawei App Gallery version 10.4 and higher. No additional integration steps are needed to start using the Huawei Referrer API.

iOS frameworks

Select your project in the Project Navigator. In the left hand side of the main view, select your target. In the tab Build Phases, expand the group Link Binary with Libraries. On the bottom of that section click on the + button. Select below mentioned frameworks and make sure to change the Status of frameworks to Optional. Adjust SDK uses these frameworks with following purpose:

  • AdServices.framework - to support Apple Search Ads campaigns
  • AdSupport.framework - to read iOS Advertising Id (IDFA) value
  • StoreKit.framework - to communicate with SKAdNetwork framework
  • AppTrackingTransparency.framework - to ask for user's consent to be tracked and obtain status of that consent

Additional features

You can take advantage of the following features once the Adjust SDK is integrated into your project.

AppTrackingTransparency framework

Note: This feature exists only in iOS platform.

For each package sent, the Adjust backend receives one of the following four (4) states of consent for access to app-related data that can be used for tracking the user or the device:

  • Authorized
  • Denied
  • Not Determined
  • Restricted

After a device receives an authorization request to approve access to app-related data, which is used for user device tracking, the returned status will either be Authorized or Denied.

Before a device receives an authorization request for access to app-related data, which is used for tracking the user or device, the returned status will be Not Determined.

If authorization to use app tracking data is restricted, the returned status will be Restricted.

The SDK has a built-in mechanism to receive an updated status after a user responds to the pop-up dialog, in case you don't want to customize your displayed dialog pop-up. To conveniently and efficiently communicate the new state of consent to the backend, Adjust SDK offers a wrapper around the app tracking authorization method described in the following chapter, App-tracking authorization wrapper.

App-tracking authorisation wrapper

Note: This feature exists only in iOS platform.

Adjust SDK offers the possibility to use it for requesting user authorization in accessing their app-related data. Adjust SDK has a wrapper built on top of the requestTrackingAuthorizationWithCompletionHandler: method, where you can as well define the callback method to get information about a user's choice. Also, with the use of this wrapper, as soon as a user responds to the pop-up dialog, it's then communicated back using your callback method. The SDK will also inform the backend of the user's choice. Integer value will be delivered via your callback method with the following meaning:

  • 0: ATTrackingManagerAuthorizationStatusNotDetermined
  • 1: ATTrackingManagerAuthorizationStatusRestricted
  • 2: ATTrackingManagerAuthorizationStatusDenied
  • 3: ATTrackingManagerAuthorizationStatusAuthorized

To use this wrapper, you can call it as such:

Adjust.requestTrackingAuthorizationWithCompletionHandler(function(status) {
    switch (status) {
        case 0:
            // ATTrackingManagerAuthorizationStatusNotDetermined case
            break;
        case 1:
            // ATTrackingManagerAuthorizationStatusRestricted case
            break;
        case 2:
            // ATTrackingManagerAuthorizationStatusDenied case
            break;
        case 3:
            // ATTrackingManagerAuthorizationStatusAuthorized case
            break;
    }
});

Before calling the method, make sure that your iOS app's Info.plist contains an entry for NSUserTrackingUsageDescription key. In absence of that key and usage of this method, app will crash.

Get current authorisation status

Note: This feature exists only in iOS platform.

To get the current app tracking authorization status you can call getAppTrackingAuthorizationStatus method of Adjust class that will return one of the following possibilities:

  • 0: The user hasn't been asked yet
  • 1: The user device is restricted
  • 2: The user denied access to IDFA
  • 3: The user authorized access to IDFA
  • -1: The status is not available

Check for ATT status change

Note: This feature exists only in iOS platform.

In cases where you are not using Adjust app-tracking authorization wrapper, Adjust SDK will not be able to know immediately upon answering the dialog what is the new value of app-tracking status. In situations like this, if you would want Adjust SDK to read the new app-tracking status value and communicate it to our backend, make sure to make a call to this method:

Adjust.checkForNewAttStatus();

SKAdNetwork framework

Note: This feature exists only in iOS platform.

If you have implemented the Adjust iOS SDK v4.23.0 or above and your app is running on iOS 14 and above, the communication with SKAdNetwork will be set on by default, although you can choose to turn it off. When set on, Adjust automatically registers for SKAdNetwork attribution when the SDK is initialized. If events are set up in the Adjust dashboard to receive conversion values, the Adjust backend sends the conversion value data to the SDK. The SDK then sets the conversion value. After Adjust receives the SKAdNetwork callback data, it is then displayed in the dashboard.

In case you don't want the Adjust SDK to automatically communicate with SKAdNetwork, you can disable that by calling the following method on configuration object:

adjustConfig.deactivateSKAdNetworkHandling();

Update SKAdNetwork conversion value

Note: This feature exists only in iOS platform.

You can use Adjust SDK wrapper method updateConversionValue to update SKAdNetwork conversion value for your user:

Adjust.updateConversionValue(6);

Conversion value updated callback

Note: This feature exists only in iOS platform.

You can register callback to get notified each time when Adjust SDK updates conversion value for the user.

var adjustConfig = new AdjustConfig(appToken, environment);

adjustConfig.setConversionValueUpdatedCallbackListener(function(conversionValue) {
    console.log("Conversion value updated callback recveived");
    console.log("Conversion value: " + conversionValue.conversionValue);
  });

Adjust.create(adjustConfig);

Event tracking

You can use Adjust to track all kinds of events. Let's say you want to track every tap on a button. Simply create a new event token in your dashboard. Let's say that event token is abc123. You can add the following line in your button’s click handler method to track the click:

var adjustEvent = new AdjustEvent("abc123");
Adjust.trackEvent(adjustEvent);

Revenue tracking

If your users can generate revenue by tapping on advertisements or making In-App Purchases, then you can track those revenues with events. Let's say a tap is worth €0.01. You could track the revenue event like this:

var adjustEvent = new AdjustEvent("abc123");

adjustEvent.setRevenue(0.01, "EUR");

Adjust.trackEvent(adjustEvent);

When you set a currency token, Adjust will automatically convert the incoming revenues into a reporting revenue of your choice. Read more about currency conversion here.

Revenue deduplication

You can also add an optional transaction ID to avoid tracking duplicate revenues. The last ten transaction IDs are remembered, and revenue events with duplicate transaction IDs are skipped. This is especially useful for In-App Purchase tracking. You can see an example below.

If you want to track in-app purchases, please make sure to call the trackEvent only if the transaction is finished and an item is purchased. That way you can avoid tracking revenue that is not actually being generated.

var adjustEvent = new AdjustEvent("abc123");

adjustEvent.setRevenue(0.01, "EUR");
adjustEvent.setTransactionId("{YourTransactionId}");

Adjust.trackEvent(adjustEvent);

Note: Transaction ID is the iOS term, unique identifier for successfully finished Android In-App-Purchases is named Order ID.

Callback parameters

You can also register a callback URL for that event in your dashboard and we will send a GET request to that URL whenever the event gets tracked. In that case you can also put some key-value pairs in an object and pass it to the trackEvent method. We will then append these named parameters to your callback URL.

For example, suppose you have registered the URL http://www.adjust.com/callback for your event with event token abc123 and execute the following lines:

var adjustEvent = new AdjustEvent("abc123");

adjustEvent.addCallbackParameter("key", "value");
adjustEvent.addCallbackParameter("foo", "bar");

Adjust.trackEvent(adjustEvent);

In that case we would track the event and send a request to:

http://www.adjust.com/callback?key=value&foo=bar

It should be mentioned that we support a variety of placeholders like {idfa} for iOS or {gps_adid} for Android that can be used as parameter values. In the resulting callback the {idfa} placeholder would be replaced with the ID for Advertisers of the current device for iOS and the {gps_adid} would be replaced with the Google Advertising ID of the current device for Android. Also note that we don't store any of your custom parameters, but only append them to your callbacks. If you haven't registered a callback for an event, these parameters won't even be read.

You can read more about using URL callbacks, including a full list of available values, in our callbacks guide.

Note: Both parameters in this method must be strings. If either of the passed parameters is not a string, the key-value pair will not be added to the parameters list.

Partner parameters

Similarly to the callback parameters mentioned above, you can also add parameters that Adjust will transmit to the network partners of your choice. You can activate these networks in your Adjust dashboard.

This works similarly to the callback parameters mentioned above, but can be added by calling the addPartnerParameter method on your AdjustEvent instance.

var adjustEvent = new AdjustEvent("abc123");

adjustEvent.addPartnerParameter("key", "value");
adjustEvent.addPartnerParameter("foo", "bar");

Adjust.trackEvent(adjustEvent);

You can read more about special partners and networks in our guide to special partners.

Note: Both parameters in this method must be strings. If either of the passed parameters is not a string, the key-value pair will not be added to the parameters list.

Callback identifier

You can also add custom string identifier to each event you want to track. This identifier will later be reported in event success and/or event failure callbacks to enable you to keep track on which event was successfully tracked or not. You can set this identifier by calling the setCallbackId method on your AdjustEvent instance:

var adjustEvent = new AdjustEvent("abc123");

adjustEvent.setCallbackId("Your-Custom-Id");

Adjust.trackEvent(adjustEvent);

Subscription tracking

Note: This feature is only available in the SDK v4.22.0 and above.

You can track App Store and Play Store subscriptions and verify their validity with the Adjust SDK. After a subscription has been successfully purchased, make the following call to the Adjust SDK:

For App Store subscription:

var subscription = new AdjustAppStoreSubscription(price, currency, transactionId, receipt);
subscription.setTransactionDate(transactionDate);
subscription.setSalesRegion(salesRegion);

Adjust.trackAppStoreSubscription(subscription);

For Play Store subscription:

var subscription = new AdjustPlayStoreSubscription(price, currency, sku, orderId, signature, purchaseToken);
subscription.setPurchaseTime(purchaseTime);

Adjust.trackPlayStoreSubscription(subscription);

Subscription tracking parameters for App Store subscription:

Subscription tracking parameters for Play Store subscription:

Note: Subscription tracking API offered by Adjust SDK expects all parameters to be passed as string values. Parameters described above are the ones which API exects you to pass to subscription object prior to tracking subscription. There are various libraries which are handling in app purchases in React Native and each one of them should return information described above in some form upon successfully completed subscription purchase. You should locate where these parameters are placed in response you are getting from library you are using for in app purchases, extract those values and pass them to Adjust API as string values.

Just like with event tracking, you can attach callback and partner parameters to the subscription object as well:

For App Store subscription:

var subscription = new AdjustAppStoreSubscription(price, currency, transactionId, receipt);
subscription.setTransactionDate(transactionDate);
subscription.setSalesRegion(salesRegion);

// add callback parameters
subscription.addCallbackParameter("key", "value");
subscription.addCallbackParameter("foo", "bar");

// add partner parameters
subscription.addPartnerParameter("key", "value");
subscription.addPartnerParameter("foo", "bar");

Adjust.trackAppStoreSubscription(subscription);

For Play Store subscription:

var subscription = new AdjustPlayStoreSubscription(price, currency, sku, orderId, signature, purchaseToken);
subscription.setPurchaseTime(purchaseTime);

// add callback parameters
subscription.addCallbackParameter("key", "value");
subscription.addCallbackParameter("foo", "bar");

// add partner parameters
subscription.addPartnerParameter("key", "value");
subscription.addPartnerParameter("foo", "bar");

Adjust.trackPlayStoreSubscription(subscription);

Session parameters

Some parameters are saved to be sent in every event and session of the Adjust SDK. Once you have added any of these parameters, you don't need to add them every time, since they will be saved locally. If you add the same parameter twice, there will be no effect.

These session parameters can be called before the Adjust SDK is launched to make sure they are sent even on install. If you need to send them with an install, but can only obtain the needed values after launch, it's possible to delay the first launch of the Adjust SDK to allow this behaviour.

Session callback parameters

The same callback parameters that are registered for events can be also saved to be sent in every event or session of the Adjust SDK.

The session callback parameters have a similar interface of the event callback parameters. Instead of adding the key and its value to an event, it's added through a call to method addSessionCallbackParameter of the Adjust instance:

Adjust.addSessionCallbackParameter("foo", "bar");

The session callback parameters will be merged with the callback parameters and added to an event. The callback parameters added to an event have precedence over the session callback parameters. Meaning that, when adding a callback parameter to an event with the same key to one added from the session, the value that prevails is the callback parameter added to the event.

Note: Both parameters in this method must be strings. If either of the passed parameters is not a string, the key-value pair will not be added to the parameters list.

It's possible to remove a specific session callback parameter by passing the desiring key to the method removeSessionCallbackParameter of the Adjust instance:

Adjust.removeSessionCallbackParameter("foo");

If you wish to remove all key and values from the session callback parameters, you can reset it with the method resetSessionCallbackParameters of the Adjust instance:

Adjust.resetSessionCallbackParameters();

Session partner parameters

In the same way that there are session callback parameters that are sent for every event or session of the Adjust SDK, there are also session partner parameters.

These will be transmitted to network partners, for the integrations that have been activated in your Adjust dashboard.

The session partner parameters have a similar interface to the event partner parameters. Instead of adding the key and its value to an event, it's added through a call to method addSessionPartnerParameter of the Adjust instance:

Adjust.addSessionPartnerParameter("foo", "bar");

The session partner parameters will be merged with the partner parameters and added to an event. The partner parameters added to an event have precedence over the session partner parameters. Meaning that, when adding a partner parameter to an event with the same key to one added from the session, the value that prevails is the partner parameter added to the event.

Note: Both parameters in this method must be strings. If either of the passed parameters is not a string, the key-value pair will not be added to the parameters list.

It's possible to remove a specific session partner parameter by passing the desiring key to the method removeSessionPartnerParameter of the Adjust instance:

Adjust.removeSessionPartnerParameter("foo");

If you wish to remove all keys and values from the session partner parameters, you can reset it with the method resetSessionPartnerParameters of the Adjust instance:

Adjust.resetSessionPartnerParameters();

Delay start

Delaying the start of the Adjust SDK allows your app some time to obtain session parameters, such as unique identifiers, to be sent on install.

Set the initial delay time in seconds with the setDelayStart field of the AdjustConfig instance:

adjustConfig.setDelayStart(5.5);

In this case this will make the Adjust SDK not send the initial install session and any event created for 5.5 seconds. After this time is expired or if you call sendFirstPackages() of the Adjust instance in the meanwhile, every session parameter will be added to the delayed install session and events and the Adjust SDK will resume as usual.

The maximum delay start time of the Adjust SDK is 10 seconds.

Attribution callback

You can register a listener to be notified of tracker attribution changes. Due to the different sources considered for attribution, this information cannot be provided synchronously. The simplest way is to create a single anonymous listener which is going to be called each time your user's attribution value changes:

With the AdjustConfig instance, before starting the SDK, add the anonymous listener:

var adjustConfig = new AdjustConfig(appToken, environment);

adjustConfig.setAttributionCallbackListener(function(attribution) {
    // Printing all attribution properties.
    console.log("Attribution changed!");
    console.log(attribution.trackerToken);
    console.log(attribution.trackerName);
    console.log(attribution.network);
    console.log(attribution.campaign);
    console.log(attribution.adgroup);
    console.log(attribution.creative);
    console.log(attribution.clickLabel);
    console.log(attribution.adid);
    console.log(attribution.costType);
    console.log(attribution.costAmount);
    console.log(attribution.costCurrency);
    console.log(attribution.fbInstallReferrer);
});

Adjust.create(adjustConfig);

Within the listener function you have access to the attribution parameters. Here is a quick summary of its properties:

  • trackerToken the tracker token of the current attribution.
  • trackerName the tracker name of the current attribution.
  • network the network grouping level of the current attribution.
  • campaign the campaign grouping level of the current attribution.
  • adgroup the ad group grouping level of the current attribution.
  • creative the creative grouping level of the current attribution.
  • clickLabel the click label of the current attribution.
  • adid the Adjust device identifier.
  • costType the cost type.
  • costAmount the cost amount.
  • costCurrency the cost currency.
  • fbInstallReferrer the cost currency (Android only).

Please make sure to consider our applicable attribution data policies.

Note: The cost data - costType, costAmount & costCurrency are only available when configured in AdjustConfig by calling setNeedsCost method. If not configured or configured, but not being part of the attribution, these fields will have value null. This feature is available in SDK v4.26.0 and above.

Session and event callbacks

You can register a callback to be notified of successful and failed tracked events and/or sessions.

Follow the same steps as for attribution callback to implement the following callback function for successfully tracked events:

var adjustConfig = new AdjustConfig(appToken, environment);

adjustConfig.setEventTrackingSucceededCallbackListener(function(eventSuccess) {
    // Printing all event success properties.
    console.log("Event tracking succeeded!");
    console.log(eventSuccess.message);
    console.log(eventSuccess.timestamp);
    console.log(eventSuccess.eventToken);
    console.log(eventSuccess.callbackId);
    console.log(eventSuccess.adid);
    console.log(eventSuccess.jsonResponse);
});

Adjust.create(adjustConfig);

The following callback function for failed tracked events:

var adjustConfig = new AdjustConfig(appToken, environment);

adjustConfig.setEventTrackingFailedCallbackListener(function(eventFailure) {
    // Printing all event failure properties.
    console.log("Event tracking failed!");
    console.log(eventFailure.message);
    console.log(eventFailure.timestamp);
    console.log(eventFailure.eventToken);
    console.log(eventFailure.callbackId);
    console.log(eventFailure.adid);
    console.log(eventFailure.willRetry);
    console.log(eventFailure.jsonResponse);
});

Adjust.create(adjustConfig);

For successfully tracked sessions:

var adjustConfig = new AdjustConfig(appToken, environment);

adjustConfig.setSessionTrackingSucceededCallbackListener(function(sessionSuccess) {
    // Printing all session success properties.
    console.log("Session tracking succeeded!");
    console.log(sessionSuccess.message);
    console.log(sessionSuccess.timestamp);
    console.log(sessionSuccess.adid);
    console.log(sessionSuccess.jsonResponse);
});

Adjust.create(adjustConfig);

And for failed tracked sessions:

var adjustConfig = new AdjustConfig(appToken, environment);

adjustConfig.setSessionTrackingFailedCallbackListener(function(sessionFailure) {
    // Printing all session failure properties.
    console.log("Session tracking failed!");
    console.log(sessionFailure.message);
    console.log(sessionFailure.timestamp);
    console.log(sessionFailure.adid);
    console.log(sessionFailure.willRetry);
    console.log(sessionFailure.jsonResponse);
});

Adjust.create(adjustConfig);

The callback functions will be called after the SDK tries to send a package to the server. Within the callback you have access to a response data object specifically for the callback. Here is a quick summary of the session response data properties:

  • var message the message from the server or the error logged by the SDK.
  • var timestamp timestamp from the server.
  • var adid a unique device identifier provided by Adjust.
  • var jsonResponse the JSON object with the response from the server.

Both event response data objects contain:

  • var eventToken the event token, if the package tracked was an event.
  • var callbackId the custom defined callback ID set on event object.

And both event and session failed objects also contain:

  • var willRetry indicates there will be an attempt to resend the package at a later time.

Disable tracking

You can disable the Adjust SDK from tracking by invoking the method setEnabled of the Adjust instance with the enabled parameter as false. This setting is remembered between sessions, but it can only be activated after the first session.

Adjust.setEnabled(false);

You can verify if the Adjust SDK is currently active with the method isEnabled of the Adjust instance. It is always possible to activate the Adjust SDK by invoking setEnabled with the parameter set to true.

Offline mode

You can put the Adjust SDK in offline mode to suspend transmission to our servers while retaining tracked data to be sent later. When in offline mode, all information is saved in a file, so be careful not to trigger too many events while in offline mode.

You can activate offline mode by calling the method setOfflineMode of the Adjust instance with the parameter true.

Adjust.setOfflineMode(true);

Conversely, you can deactivate offline mode by calling setOfflineMode with false. When the Adjust SDK is put back in online mode, all saved information is send to our servers with the correct time information.

Unlike disabling tracking, this setting is not remembered between sessions. This means that the SDK is in online mode whenever it is started, even if the app was terminated in offline mode.

Event buffering

If your app makes heavy use of event tracking, you might want to delay some HTTP requests in order to send them in one batch every minute. You can enable event buffering with your AdjustConfig instance by calling setEventBufferingEnabled method:

var adjustConfig = new AdjustConfig(appToken, environment);

adjustConfig.setEventBufferingEnabled(true);

Adjust.create(adjustConfig);

GDPR right to be forgotten

In accordance with article 17 of the EU's General Data Protection Regulation (GDPR), you can notify Adjust when a user has exercised their right to be forgotten. Calling the following method will instruct the Adjust SDK to communicate the user's choice to be forgotten to the Adjust backend:

Adjust.gdprForgetMe();

Upon receiving this information, Adjust will erase the user's data and the Adjust SDK will stop tracking the user. No requests from this device will be sent to Adjust in the future.

Third-party sharing for specific users

You can notify Adjust when a user disables, enables, and re-enables data sharing with third-party partners.

Disable third-party sharing for specific users

Call the following method to instruct the Adjust SDK to communicate the user's choice to disable data sharing to the Adjust backend:

var adjustThirdPartySharing = new AdjustThirdPartySharing(false);
Adjust.trackThirdPartySharing(adjustThirdPartySharing);

Upon receiving this information, Adjust will block the sharing of that specific user's data to partners and the Adjust SDK will continue to work as usual.

Call the following method to instruct the Adjust SDK to communicate the user's choice to share data or change data sharing, to the Adjust backend:

var adjustThirdPartySharing = new AdjustThirdPartySharing(true);
Adjust.trackThirdPartySharing(adjustThirdPartySharing);

Upon receiving this information, Adjust changes sharing the specific user's data to partners. The Adjust SDK will continue to work as expected.

Call the following method to instruct the Adjust SDK to send the granular options to the Adjust backend:

var adjustThirdPartySharing = new AdjustThirdPartySharing(null);
adjustThirdPartySharing.addGranularOption("PartnerA", "foo", "bar");
Adjust.trackThirdPartySharing(adjustThirdPartySharing);

Consent measurement for specific users

You can notify Adjust when a user exercises their right to change data sharing with partners for marketing purposes, but they allow data sharing for statistical purposes.

Call the following method to instruct the Adjust SDK to communicate the user's choice to change data sharing, to the Adjust backend:

Adjust.trackMeasurementConsent(true);

Upon receiving this information, Adjust changes sharing the specific user's data to partners. The Adjust SDK will continue to work as expected.

SDK signature

When you set up the SDK Signature, each SDK communication package is "signed". This lets Adjust’s servers easily detect and reject any install activity that is not legitimate.

There are just a few steps involved in setting up the SDK Signature. Please contact your Technical Account Manager or [email protected] to get started.

Background tracking

The default behaviour of the Adjust SDK is to pause sending HTTP requests while the app is in the background. You can change this in your AdjustConfig instance by calling setSendInBackground method:

var adjustConfig = new AdjustConfig(appToken, environment);

adjustConfig.setSendInBackground(true);

Adjust.create(adjustConfig);

If nothing is set, sending in background is disabled by default.

Device IDs

Certain services (such as Google Analytics) require you to coordinate device and client IDs in order to prevent duplicate reporting.

iOS advertising identifier

You can access the IDFA value of an iOS device by invoking the getIdfa method of the Adjust instance and passing it a callback that will get triggered once the IDFA value has been obtained by the native iOS SDK:

Adjust.getIdfa((idfa) => {
    console.log("IDFA = " + idfa);
});

Google Play Services advertising identifier

The Google Play Services Advertising Identifier (Google advertising ID) is a unique identifier for a device. Users can opt out of sharing their Google advertising ID by toggling the "Opt out of Ads Personalization" setting on their device. When a user has enabled this setting, the Adjust SDK returns a string of zeros when trying to read the Google advertising ID.

Important: If you are targeting Android 12 and above (API level 31), you need to add the com.google.android.gms.AD_ID permission to your app. If you do not add this permission, you will not be able to read the Google advertising ID even if the user has not opted out of sharing their ID.

The Adjust SDK allows you to read the Google advertising identifier of the Android device on which your app is running. In order to do this, call the getGoogleAdId method of the Adjust instance and pass your callback as a parameter. Once obtained by the native Android SDK, you will receive the Google advertising identifier value in your callback method:

Adjust.getGoogleAdId((googleAdId) => {
    console.log("Google Ad Id = " + googleAdId);
});

Amazon advertising identifier

If you need to obtain the Amazon advertising ID, you can call the getAmazonAdId method of the Adjust instance and pass your callback as a parameter to which the Amazon advertising ID value will be sent once obtained:

Adjust.getAmazonAdId((amazonAdId) => {
    console.log("Amazon Ad Id = " + amazonAdId);
});

Adjust device identifier

For every device with your app installed on it, the Adjust backend generates a unique Adjust device identifier (adid). In order to obtain this identifier, call the getAdid method of the Adjust instance and pass your callback as a parameter to which the adid value will be sent once obtained:

Adjust.getAdid((adid) => {
    console.log("Adid = " + adid);
});

Note: Information about the adid is only available after an app installation has been tracked by the Adjust backend. From that moment on, the Adjust SDK has information about the device adid and you can access it with this method. So, it is not possible to access the adid value before the SDK has been initialized and installation of your app has been successfully tracked.

Set external device ID

Note If you want to use external device IDs, please contact your Adjust representative. They will talk you through the best approach for your use case.

An external device identifier is a custom value that you can assign to a device or user. They can help you to recognize users across sessions and platforms. They can also help you to deduplicate installs by user so that a user isn't counted as multiple new installs.

You can also use an external device ID as a custom identifier for a device. This can be useful if you use these identifiers elsewhere and want to keep continuity.

Check out our external device identifiers article for more information.

Note This setting requires Adjust SDK v4.21.0 or later.

To set an external device ID, assign the identifier to the externalDeviceId property of your config instance. Do this before you initialize the Adjust SDK.

adjustConfig.setExternalDeviceId("{Your-External-Device-Id}");

Important: You need to make sure this ID is unique to the user or device depending on your use-case. Using the same ID across different users or devices could lead to duplicated data. Talk to your Adjust representative for more information.

If you want to use the external device ID in your business analytics, you can pass it as a session callback parameter. See the section on session callback parameters for more information.

You can import existing external device IDs into Adjust. This ensures that the backend matches future data to your existing device records. If you want to do this, please contact your Adjust representative.

User attribution

This callback is triggered as described in the attribution callback section, providing you with information about a new attribution whenever it changes. If you want to access information about a user's current attribution status at any other time, you can make a call to the getAttribution method of the Adjust instance and pass your callback as a parameter to which the attribution value will be sent once obtained:

Adjust.getAttribution((attribution) => {
    console.log("Tracker token = " + attribution.trackerToken);
    console.log("Tracker name = " + attribution.trackerName);
    console.log("Network = " + attribution.network);
    console.log("Campaign = " + attribution.campaign);
    console.log("Adgroup = " + attribution.adgroup);
    console.log("Creative = " + attribution.creative);
    console.log("Click label = " + attribution.clickLabel);
    console.log("Adid = " + attribution.adid);
});

Note: Information about a user's current attribution status is only available after an app installation has been tracked by the Adjust backend and the attribution callback has been triggered. From that moment on, the Adjust SDK has information about a user's attribution status and you can access it with this method. So, it is not possible to access a user's attribution value before the SDK has been initialized and an attribution callback has been triggered.

Push token

To send us the push notification token, add the following call to Adjust whenever you get your token in the app or when it gets updated:

Adjust.setPushToken("YourPushNotificationToken");

Push tokens are used for Audience Builder and client callbacks, and they are required for the upcoming uninstall tracking feature.

Track additional device identifiers

If you are distributing your Android app outside of the Google Play Store and would like to track additional device identifiers (IMEI and MEID), you need to explicitly instruct the Adjust SDK to do so. You can do that by calling the setReadMobileEquipmentIdentity method of the AdjustConfig instance. The Adjust SDK does not collect these identifiers by default.

var adjustConfig = new AdjustConfig(appToken, environment);

adjustConfig.setReadMobileEquipmentIdentity(true);

Adjust.create(adjustConfig);

You will also need to add the READ_PHONE_STATE permission to your AndroidManifest.xml file:

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

In order to use this feature, additional steps are required within your Adjust Dashboard. For more information, please contact your dedicated account manager or write an email to [email protected].

Pre-installed trackers

If you want to use the Adjust SDK to recognize users that found your app pre-installed on their device, follow these steps.

  1. Create a new tracker in your dashboard.

  2. Open your app delegate and add set the default tracker of your AdjustConfig instance:

    var adjustConfig = new AdjustConfig(appToken, environment);
    
    adjustConfig.setDefaultTracker("{TrackerToken}");
    
    Adjust.create(adjustConfig);

Replace {TrackerToken} with the tracker token you created in step 2. Please note that the dashboard displays a tracker URL (including http://app.adjust.com/). In your source code, you should specify only the six-character token and not the entire URL.

  1. Build and run your app. You should see a line like the following in the app's log output:

    Default tracker: 'abc123'
    

Deep linking

If you are using the Adjust tracker URL with an option to deep link into your app from the URL, there is the possibility to get info about the deep link URL and its content. Hitting the URL can happen when the user has your app already installed (standard deep linking scenario) or if they don't have the app on their device (deferred deep linking scenario).

Standard deep linking scenario

To support deep linking in Android, the app's AndroidManifest.xml file will need to be modified. Please refer to this page of our Android SDK for the needed modifications to AndroidManifest.xml.

To support deep linking in iOS 8 or earlier, the app's Info.plist file will need to be modified. Please refer to this page of our iOS SDK for the needed modifications to Info.plist.

To support deep linking in iOS 9 or later, your app would have to handle Universal Links. Please refer to this page of our iOS SDK for the needed modifications.

After that, refer to this page of the React Native offical docs for instructions on how to support both platforms and obtain deep link URL in your JavaScript code.

Deferred deep linking scenario

While deferred deep linking is not supported out of the box on Android and iOS, our Adjust SDK makes it possible.

In order to get info about the URL content in a deferred deep linking scenario, you should set a callback method on the AdjustConfig object which will receive one parameter where the content of the URL will be delivered. You should set this method on the config object by calling the method setDeferredDeeplinkCallbackListener:

var adjustConfig = new AdjustConfig(appToken, environment);

adjustConfig.setDeferredDeeplinkCallbackListener(function(deeplink) {
    console.log("Deferred deep link URL content: " + deeplink);
});

Adjust.create(adjustConfig);

In the deferred deep linking scenario, there is one additional setting which can be set on the AdjustConfig object. Once the Adjust SDK gets the deferred deep link info, we are offering you the possibility to choose whether our SDK should open this URL or not. You can choose to set this option by calling the setShouldLaunchDeeplink method on the config object:

var adjustConfig = new AdjustConfig(appToken, environment);

adjustConfig.setShouldLaunchDeeplink(true);
// or adjustConfig.setShouldLaunchDeeplink(false);

adjustConfig.setDeferredDeeplinkCallbackListener(function(deeplink) {
    console.log("Deferred deep link URL content: " + deeplink);
});

Adjust.create(adjustConfig);

If nothing is set, the Adjust SDK will always try to launch the URL by default.

Reattribution via deep links

Adjust enables you to run re-engagement campaigns by using deep links. For more information on this, please check our official docs.

If you are using this feature, in order for your user to be properly reattributed, you need to make one additional call to the Adjust SDK in your app. Once you have received deep link content information in your app, add a call to appWillOpenUrl method of the Adjust instance. By making this call, the Adjust SDK will try to find if there is any new attribution info inside of the deep link and if any, it will be sent to the Adjust backend. If your user should be reattributed due to a click on the Adjust tracker URL with deep link content in it, you will see the attribution callback in your app being triggered with new attribution info for this user.

Call to the appWillOpenUrl method in a React component would look like this:

componentDidMount() {
    Linking.addEventListener('url', this.handleDeepLink);
    Linking.getInitialURL().then((url) => {
        if (url) {
            this.handleDeepLink({ url });
        }
    })
}

componentWillUnmount() {
    Linking.removeEventListener('url', this.handleDeepLink);
}

handleDeepLink(event) {
    Adjust.appWillOpenUrl(event.url);
}

Data residency

In order to enable data residency feature, make sure to call setUrlStrategy method of the AdjustConfig instance with one of the following constants:

adjustConfig.setUrlStrategy(AdjustConfig.DataResidencyEU); // for EU data residency region
adjustConfig.setUrlStrategy(AdjustConfig.DataResidencyTR); // for Turkey data residency region
adjustConfig.setUrlStrategy(AdjustConfig.DataResidencyUS); // for US data residency region

COPPA compliance

By default Adjust SDK doesn't mark app as COPPA compliant. In order to mark your app as COPPA compliant, make sure to call setCoppaCompliantEnabled method of AdjustConfig instance with parameter true:

adjustConfig.setCoppaCompliantEnabled(true);

Note: By enabling this feature, third-party sharing will be automatically disabled for the users. If later during the app lifetime you decide not to mark app as COPPA compliant anymore, third-party sharing will not be automatically re-enabled. Instead, next to not marking your app as COPPA compliant anymore, you will need to explicitly re-enable third-party sharing in case you want to do that.

Play Store Kids Apps

Note: This feature exists only in Android platform.

By default Adjust SDK doesn't mark Android app as Play Store Kids App. In order to mark your app as the app which is targetting kids in Play Store, make sure to call setPlayStoreKidsAppEnabled method of AdjustConfig instance with parameter true:

adjustConfig.setPlayStoreKidsAppEnabled(true);

License

The Adjust SDK is licensed under the MIT License.

Copyright (c) 2012-Present Adjust GmbH, http://www.adjust.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

react_native_sdk's People

Contributors

abrel avatar aditi3 avatar adrien-may avatar borismisnik avatar dependabot[bot] avatar hamidhadi avatar honeyp0t avatar huextrat avatar ivosam3 avatar ken0nek avatar naturalclar avatar nonelse avatar philipheinser avatar philipshurpik avatar rawrmaan avatar ruiaraujo avatar sporiff avatar tecbot avatar titozzz avatar uerceg avatar youedd 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react_native_sdk's Issues

Error building the project

screen shot 2018-09-27 at 13 58 58

I want to make a beta build of the app and I receive the above mentioned error. On the debug mode this works fine. Any ideas?

Versions:
npm: 5.6.0
react-native-cli: 2.0.1
react-native: 0.52.3
Platform: iOS

TypeError: undefined is not an object (evaluating 'this.eventToken = eventToken'

I am running in debug mode on the iOS emulated, I have already reinstalled the app, installed pod install, reinstalled dependencies and got no results.

can anybody help me? I recently closed the contract.

Steps:

install dependence with: yarn add react-native-adjust --save
Add line in Podfile: pod 'react-native-adjust', :path => '../node_modules/react-native-adjust'
Entrypoint.js file in my project add:
import { Adjust, AdjustConfig } from 'react-native-adjust';
and

const adjustConfig = new AdjustConfig('{multiplataformKey}', AdjustConfig.EnvironmentSandbox);
    Adjust.create(adjustConfig);
  componentWillUnmount() { // C
    Adjust.componentWillUnmount();
  }

LoginView.js add:

import { AdjustEvent } from 'react-native-adjust';
  renderFacebookLogin = () => (
    <Icon.Button
      onPress={() => {
        AdjustEvent(
          'kmii48'
        )
        this.fbLogin
      }}
 >

"react-native-adjust": "^4.21.0",
"react": "16.9.0",
"react-native": "0.61.2",

Details about my MainApplication.java add:

...
import com.adjust.nativemodule.AdjustPackage;

...
  private final ReactNativeHost mReactNativeHost =
      new ReactNativeHost(this) {

          @Override
          protected String getJSBundleFile(){
              return CodePush.getJSBundleFile();
          }

          @Override
          public boolean getUseDeveloperSupport() {
              return BuildConfig.DEBUG;
            }

        @Override
        protected List<ReactPackage> getPackages() {
          @SuppressWarnings("UnnecessaryLocalVariable")
          List<ReactPackage> packages = new PackageList(this).getPackages();
          // Packages that cannot be autolinked yet can be added manually here, for example:
          packages.add(new CodePush(codePushKey, getApplicationContext(), BuildConfig.DEBUG));
          packages.add(new RNFirebaseNotificationsPackage());
          packages.add(new RNFirebaseMessagingPackage());
          packages.add(new FBSDKPackage());
          packages.add(new RNFirebaseCrashlyticsPackage());
          packages.add(new RNFirebaseAnalyticsPackage());
          packages.add(new RNFirebaseLinksPackage());
          packages.add(new AdjustPackage());
          return packages;
        }

        @Override
        protected String getJSMainModuleName() {
          return "index";
        }
      };


I had created this issue by mistake in the adjust-android repository:
adjust/android_sdk#442

The SDK Build Tools revision (23.0.1) is too low for project

The SDK Build Tools revision (23.0.1) is too low for project ':react-native-adjust'. Minimum required is 25.0.0.

screen shot 2018-06-14 at 7 24 03 pm

package.json
"react-native-adjust": "4.13.0",

MainApplication.java
import com.adjust.nativemodule.AdjustPackage;

main build.gradle

android {
  compileSdkVersion 26
  buildToolsVersion '26.0.1'

  defaultConfig {
    applicationId 'com.otcme.otcme'
    targetSdkVersion 25
    versionCode 1
    versionName '1.0.10'
    ndk {
      abiFilters 'armeabi-v7a', 'x86'
    }
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    // Deprecated. Used by net.openid:appauth
    manifestPlaceholders = [
      'appAuthRedirectScheme': 'host.exp.exponent'
    ]

...
dependencies {
...
    compile project(':react-native-adjust')
...

What am I missing?

screen shot 2018-06-14 at 7 25 30 pm
screen shot 2018-06-14 at 7 25 24 pm

Can't integrate Adjust react-native-sdk using pod

I have added following line in pod file.
pod 'react-native-adjust', :path => '../node_modules/react-native-adjust'
After pod installation i got "RCTEventEmitter.h file not found" error while run a project.
screen shot 2018-10-23 at 7 06 50 pm

I am using
"react": "^16.0.0",
"react-native": "^0.50.3",
"react-native-adjust": "^4.15.0",

Crash when accessing pushToken on iOS

Adjust.create() fails due to
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryI isEqualToString:]: unrecognized selector sent to instance 0x112018800'
when accessing pushToken here.

It works if comment out this line on iOS module side.

[selfI setPushToken:pushToken];

I'm Wondering invalid value is saved or failed to get value via UserDefaults.
How to deal with this issue?

react-native info:

System:
    OS: macOS 10.15
    CPU: (6) x64 Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz
    Memory: 5.20 GB / 40.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
    Yarn: 1.19.1 - /usr/local/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.1
      System Images: android-29 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5977832
    Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.5 => 0.61.5

IOS installation

Hello,

I tried to install your react-native sdk on iOS, but i encountered some issues on both of your solutions.

with RN link:

Scanning folders for symlinks in /Users/***/***/node_modules (15ms)
rnpm-install info Android module react-native-adjust is already linked
rnpm-install info Linking react-native-adjust ios dependency
rnpm-install ERR! Something went wrong while linking. Error: Cannot read property 'match' of undefined
Please file an issue here: https://github.com/facebook/react-native/issues

with CocoaPods:

** BUILD FAILED **

The following build commands failed:
        CompileC /Users/***/***/ios/build/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-adjust.build/Objects-normal/x86_64/AdjustEventEmitter.o /Users/***/***/node_modules/react-native-adjust/ios/AdjustEventEmitter.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Installing build/Build/Products/Debug-iphonesimulator/***.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/***.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist


error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Environment:

  OS: macOS High Sierra 10.13.2
  Node: 9.2.1
  Yarn: 1.7.0
  npm: 5.5.1
  Watchman: 4.9.0
  Xcode: Xcode 9.4.1 Build version 9F2000
  Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
  react: 16.2.0 => 16.2.0
  react-native: 0.51.0 => 0.51.0

Best regards.

How do I completely uninstall this library?

I don't see any instructions in the README about how to remove the library. I removed the Podfile code and thought that was all that is needed. Now I still have a bunch of references in my .pbxproj file.

Support RN >= 0.60 autolinking

Running a project with either react-native run-ios or react-native run-android the following message appears:

error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
  - react-native-adjust (to unlink run: "react-native unlink react-native-adjust")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

On the README section it's stated that react-native link is still needed.

How to test Deferred Deeplinking in Release Build + adjust production environment?

Hi,

I was testing successful in the (android / ios Debug build + adjust sandbox environment)
=> reference : adjust/android_sdk#360

but, ( release build + adjust production environment + App Store beta version install ) is not working.
ex) * not release mode in store, only beta mode in store.
android : https://play.google.com/apps/testing/com.noahclient.dev

How to test Deferred Deeplinking in (android/ios) Release Build + adjust production environment?

If you've seen success in development environment, are you surely successful in the release environment?

Adjust - NoClassDefFoundError com.facebook.FacebookSdk with 'com.google.android.gms:play-services-analytics:9.8.0'

Hi team,

We integrated our react-native application (for Android and iOS) with Facebook SDK and Adjust.
Integration with Adjust was done according to instruction from https://github.com/adjust/react_native_sdk.

After adding the following line into build.gradle:
compile 'com.google.android.gms:play-services-analytics:9.8.0'

application on Android 4.0 - 4.4 started fails with the following exception:
Caused by java.lang.NoClassDefFoundError
com.facebook.FacebookSdk. (FacebookSdk.java:83)

meanwhile Android 5.0 and higher versions works fine.
Without the line above app works fine for all Android versions. Seems that Adjust also track custom events without 'play-services-analytics'.

Do you have any ideas why exception is thrown? And if we just remove 'play-services-analytics', will Adjust work appropriately (for tracking custom events)?

App has the following RN dependencies:

  • "react": "15.4.1",
  • "react-native": "0.39.2",
  • "react-native-adjust": "4.10.0"

If you need any additional information, please let me know.
Thanks in advance

Best regards,
Vasiliy

Cannot get deferred deeplinking to work on iOS

Using react-native-adjust v4.23.0.

Universal links are working fine on iOS. Both deeplinking and deferred deeplinking is working as expected on Android. Our problem is only with deferred deeplinking on iOS.

Have following the instructions here several times without success: https://help.adjust.com/en/article/direct-links-for-ios#as-a-new-user.

I am calling the following methods:

adjustConfig.setShouldLaunchDeeplink(true)
adjustConfig.setDeferredDeeplinkCallbackListener(deeplink => {
   // never gets called
})
Adjust.create(adjustConfig)

I have some questions:

  1. Is an app scheme necessary and is it necessary to implement this in the app for deferred deeplinking to work on iOS? I have attempted to add this in Xcode although it has caused the initialization time of the app to increase.
  2. Could I be missing anything from the setup on iOS? I have added the following snippet to AppDelegate.m
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity
 restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
{
 return [RCTLinkingManager application:application
                  continueUserActivity:userActivity
                    restorationHandler:restorationHandler];
}

But as I said, with this universal linking is working when the app is installed.

Build fails for android targetSdkVersion = 27

Description

Release build fails when using targetSdkVersion = 27.

/workspace/pocs/adjustPoc/android
→ ./gradlew assembleRelease

> Configure project :app
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

> Configure project :react-native-adjust
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

> Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
Loading dependency graph, done.
bundle: Writing bundle output to: /Users/v.reis/workspace/pocs/adjustPoc/android/app/build/generated
/assets/react/release/index.android.bundle
bundle: Done writing bundle output

error: invalid file path '/Users/v.reis/workspace/pocs/adjustPoc/node_modules/react-native-adjust/an
droid/build/intermediates/manifests/aapt/release/AndroidManifest.xml'.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-adjust:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details

How to reproduce

  1. Create a reactive native project & install adjust package.
  2. Set the config to build with targetSdkVersion = 27.
    In the file ./android/build.gradle edit the following section as
buildscript {
    ext {
        buildToolsVersion = "27.0.3"
        minSdkVersion = 17
        compileSdkVersion = 27
        targetSdkVersion = 27
        supportLibVersion = "27.1.1"
    }
  1. ./gradlew assembleRelease

Criticality

We are unable to release new versions because of this behaviour...

SDK won't send sdk_click for install

Hi, I added adjust sdk to my sample app , but the sdk_click request won't send from my app however , session and attribution requests are geting send:

export default class App extends Component{

	_onPress() {
		var adjustEvent = new AdjustEvent("03v1w4");
		Adjust.trackEvent(adjustEvent);
		Alert.alert("OK");
	 }
	componentWillMount(){
		var adjustConfig = new AdjustConfig("bwyeo7y07nlb", AdjustConfig.EnvironmentProduction);
		Adjust.create(adjustConfig);
	}

	componentWillUnmount() {
		Adjust.componentWillUnmount();
	}
}

This is my App.js file , Is this anything wrong? (In documntiation mentioned that put this in index.android.js but in newer version of react native index.android.js is deleted)

Expo/CRNA app

Do Expo/CRNA apps need to be ejected to use this sdk?

Library not found for -lAdjust

I'm encountering this issue since I've been trying to upgrade to react native 0.60.5. I've removed all the other linker flags except the $(inherit). And then I've removed the linked Frameworks and Libraries instead of JavaScriptCore.framework. Since the react native

Here's the specs of my project.
React: 16.9
React Native: 0.60.5
Pods Target Version: 10.0
react-native-adjust: 4.18.1

Ld /Users/{user}/Library/Developer/Xcode/DerivedData/{project}-bcghpdavibjrybeabongdfoghcci/Build/Products/Debug-iphonesimulator/{project}.app/{project} normal x86_64 (in target: {project})
    cd /Users/{user}/{project}/ios
    export IPHONEOS_DEPLOYMENT_TARGET=10.0
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk -L/Users/{user}/Library/Developer/Xcode/DerivedData/{project}-bcghpdavibjrybeabongdfoghcci/Build/Products/Debug-iphonesimulator -F/Users/{user}/Library/Developer/Xcode/DerivedData/{project}-bcghpdavibjrybeabongdfoghcci/Build/Products/Debug-iphonesimulator -F/Users/{user}/{project}/ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework -F/Users/{user}/{project}/ios -filelist /Users/{user}/Library/Developer/Xcode/DerivedData/{project}-bcghpdavibjrybeabongdfoghcci/Build/Intermediates.noindex/{project}.build/Debug-iphonesimulator/{project}.build/Objects-normal/x86_64/{project}.LinkFileList -Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=10.0 -Xlinker -object_path_lto -Xlinker /Users/{user}/Library/Developer/Xcode/DerivedData/{project}-bcghpdavibjrybeabongdfoghcci/Build/Intermediates.noindex/{project}.build/Debug-iphonesimulator/{project}.build/Objects-normal/x86_64/{project}_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/{user}/Library/Developer/Xcode/DerivedData/{project}-bcghpdavibjrybeabongdfoghcci/Build/Intermediates.noindex/{project}.build/Debug-iphonesimulator/{project}.build/Objects-normal/x86_64/{project}.swiftmodule -ObjC -lAdjust -lBVLinearGradient -lBranch -lDoubleConversion -lFolly -lGoogleAnalyticsServices -lRCTYouTube -lRNCAsyncStorage -lRNDeviceInfo -lRNFS -lRNFastImage -lRNFileViewer -lRNGestureHandler -lRNLocalize -lRNReanimated -lRNSVG -lRNShare -lRNVectorIcons -lReact-Core -lReact-DevSupport -lReact-RCTActionSheet -lReact-RCTAnimation -lReact-RCTBlob -lReact-RCTImage -lReact-RCTLinking -lReact-RCTNetwork -lReact-RCTSettings -lReact-RCTText -lReact-RCTVibration -lReact-RCTWebSocket -lReact-cxxreact -lReact-jsi -lReact-jsiexecutor -lReact-jsinspector -lSDWebImage -lSDWebImageWebPCoder -lglog -llibwebp -lreact-native-adjust -lreact-native-branch -lreact-native-config -lreact-native-document-picker -lreact-native-google-analytics-bridge -lreact-native-idfa -lreact-native-image-picker -lreact-native-image-resizer -lreact-native-onesignal -lreact-native-orientation -lreact-native-pdf -lreact-native-splash-screen -lreact-native-webview -lrn-fetch-blob -lsqlite3.0 -lstdc++ -lyoga -lz -framework AdSupport -framework CoreData -framework CoreGraphics -framework Foundation -framework ImageIO -framework JavaScriptCore -framework MobileCoreServices -framework OneSignal -framework QuartzCore -framework SafariServices -framework SystemConfiguration -framework UIKit -framework UserNotifications -framework WebKit -weak_framework AdSupport -weak_framework CoreTelephony -weak_framework iAd -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/{user}/Library/Developer/Xcode/DerivedData/{project}-bcghpdavibjrybeabongdfoghcci/Build/Intermediates.noindex/{project}.build/Debug-iphonesimulator/{project}.build/{project}.app-Simulated.xcent -framework JavaScriptCore -lPods-{project} -Xlinker -dependency_info -Xlinker /Users/{user}/Library/Developer/Xcode/DerivedData/{project}-bcghpdavibjrybeabongdfoghcci/Build/Intermediates.noindex/{project}.build/Debug-iphonesimulator/{project}.build/Objects-normal/x86_64/{project}_dependency_info.dat -o /Users/{user}/Library/Developer/Xcode/DerivedData/{project}-bcghpdavibjrybeabongdfoghcci/Build/Products/Debug-iphonesimulator/{project}.app/{project}

ld: library not found for -lAdjust
clang: error: linker command failed with exit code 1 (use -v to see invocation)

[Question] Using adjust with wix/react-native-navigation

Hi!

We are gonna add adjust tracking to our react native application. We are using wix/react-native-navigation library for our app navigation.

In the documentation, you state the initialization should be done in the App.js file, however, react-native-navigation doesn't really have a global app wrapper (or I'm not aware of it).

Where would you recommend we put the Adjust.create and Adjust.componentWillUnmount methods?

I can see putting the Adjust.create method inside the registerAppLaunchedListener method but I'm unsure (if even needed) where to put the Adjust.componentWillUnmount.

Thank you for your response!

getGoogleAdId returns always null

Adjust.getGoogleAdId((googleAdId) => {
console.log("Google Ad Id = " + googleAdId);
});
returns always null

in log i see it

Parameters:
android_uuid 15699ad4-9df1-44a3-b3f7-ac73717c6d61
api_level 25
app_token 2fm9gkqubvpc
app_version 1.0
attribution_deeplink 1
callback_params {"scpk2":"scpv2"}
connectivity_type 1
country RU
cpu_type arm64-v8a
created_at 2020-05-28T10:07:11.461Z+0300
device_manufacturer Xiaomi
device_name Redmi 4X
device_type phone
display_height 1280
display_width 720
environment sandbox
event_buffering_enabled 0
event_count 1
event_token g3mfiw
gps_adid 119fe9c7-f7e1-420f-baae-eb1a31d6cad2

[ANDROID] Deferred deeplink doesn't redirect to exact page - don't work at all.

The example adjust specific links I use to test deferred deeplinking:
[](https://app.adjust.com/?deep_link=https%3A%2F%2Fqa-brandsforless.bfl.dev%2Fen-ae%2Frobot-triceratops-tee%2F999%2Fp%2F)
[](https://app.adjust.com/?deep_link=https%3A%2F%2Fqa-brandsforless.bfl.dev%2Fen-ae%2Fwomen%2Fclothing%2Fbodysuit%2F).

Step to repro:

  1. If app is not installed on device, redirecting to specified Custom URL (3-d party .apk sharing platform).
  2. After FIRST STEP, app is downloaded and installed successfully, so I'm starting it, and then application should open deep_link url as an Adjust callback. But it do not.

Adjust not initialized correctly

After initialize the SDK I'm receiving Adjust not initialized correctly.

App.js:

constructor(props) {
    super(props);
    var adjustConfig = new AdjustConfig("{key}", AdjustConfig.EnvironmentSandbox);
    adjustConfig.setLogLevel(AdjustConfig.LogLevelVerbose);
    Adjust.create(adjustConfig);
}

Versions:

"react": "16.8.3",
"react-native": "0.59.8",
"react-native-adjust": "^4.17.2"

Android:
implementation 'com.google.android.gms:play-services-analytics:16.0.8'

Permissions:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Logs:

2019-05-31 16:21:19.846 2609-2609/com.adjustexample E/Adjust: Adjust not initialized correctly
2019-05-31 16:21:20.174 2609-2659/com.adjustexample I/ReactNativeJS: Running application "AdjustExample" with appParams: {"rootTag":1}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
2019-05-31 16:21:20.243 2609-2660/com.adjustexample W/Adjust: SANDBOX: Adjust is running in Sandbox mode. Use this setting for testing. Don't forget to set the environment to `production` before publishing!
2019-05-31 16:21:20.244 2609-2660/com.adjustexample W/Adjust: SANDBOX: Adjust is running in Sandbox mode. Use this setting for testing. Don't forget to set the environment to `production` before publishing!
2019-05-31 16:21:20.244 2609-2660/com.adjustexample W/Adjust: SANDBOX: Adjust is running in Sandbox mode. Use this setting for testing. Don't forget to set the environment to `production` before publishing!
2019-05-31 16:21:20.376 2609-2709/com.adjustexample D/Adjust: Read Attribution: tt:cr1b77y tn:Organic net:Organic cam:null adg:null cre:null cl:null adid:8d5244592279f8fd6d2d974281b178ae
2019-05-31 16:21:20.385 2609-2709/com.adjustexample D/Adjust: Read Activity state: ec:0 sc:1 ssc:2 sl:1101.9 ts:1047.0 la:11:12:13 uuid:cb773288-26d2-40e2-934c-69854dd13594
2019-05-31 16:21:20.385 2609-2709/com.adjustexample D/Adjust: Session Callback parameters file not found
2019-05-31 16:21:20.385 2609-2709/com.adjustexample D/Adjust: Session Partner parameters file not found
2019-05-31 16:21:20.385 2609-2709/com.adjustexample D/Adjust: adjust_config.properties file not found in this app
2019-05-31 16:21:20.486 2609-2709/com.adjustexample I/Adjust: Google Play Services Advertising ID read correctly at start time
2019-05-31 16:21:20.486 2609-2709/com.adjustexample V/Adjust: Foreground timer configured to fire after 60.0 seconds of starting and cycles every 60.0 seconds
2019-05-31 16:21:20.513 2609-2709/com.adjustexample V/Adjust: Foreground timer starting
2019-05-31 16:21:20.514 2609-2709/com.adjustexample V/Adjust: Subsession start
2019-05-31 16:21:20.535 2609-2714/com.adjustexample D/Adjust: Read Package queue: []
2019-05-31 16:21:20.535 2609-2714/com.adjustexample D/Adjust: Package handler read 0 packages
2019-05-31 16:21:20.560 2609-2709/com.adjustexample D/Adjust: Wrote Activity state: ec:0 sc:2 ssc:1 sl:0.0 ts:0.0 la:11:12:13 uuid:cb773288-26d2-40e2-934c-69854dd13594
2019-05-31 16:21:20.560 2609-2714/com.adjustexample D/Adjust: Added package 1 (session)
2019-05-31 16:21:20.562 2609-2714/com.adjustexample V/Adjust: Path:      /session
    ClientSdk: [email protected]
    Parameters:
    	android_uuid     cb773288-26d2-40e2-934c-69854dd13594
    	api_level        24
    	app_token        qwerty123456
    	app_version      1.0
    	attribution_deeplink 1
    	connectivity_type 0
    	country          US
    	cpu_type         x86
    	created_at       2019-05-31T16:21:20.514Z-0300
    	device_manufacturer Google
    	device_name      Android SDK built for x86
    	device_type      phone
    	display_height   1794
    	display_width    1080
    	environment      sandbox
    	event_buffering_enabled 0
    	gps_adid         3892b11a-6939-4ea4-9168-5856d0062ddb
    	gps_adid_src     service
    	hardware_name    NYC
    	installed_at     2019-05-31T14:58:53.542Z-0300
    	language         en
    	last_interval    3350
    	mcc              310
    	mnc              260
    	needs_response_details 1
    	network_type     13
    	os_build         NYC
    	os_name          android
    	os_version       7.0
    	package_name     com.adjustexample
    	screen_density   high
    	screen_format    normal
    	screen_size      normal
    	session_count    2
    	session_length   1102
    	subsession_count 2
    	time_spent       1047
    	tracking_enabled 1
    	updated_at       2019-05-31T15:07:58.790Z-0300
2019-05-31 16:21:20.565 2609-2714/com.adjustexample D/Adjust: Wrote Package queue: [session]
2019-05-31 16:21:20.565 2609-2709/com.adjustexample W/Adjust: InstallReferrer not integrated in project (com.android.installreferrer.api.InstallReferrerClient) thrown by (java.lang.ClassNotFoundException)
2019-05-31 16:21:20.566 2609-2714/com.adjustexample D/Adjust: Package handler wrote 1 packages
2019-05-31 16:21:26.963 2609-2718/com.adjustexample V/Adjust: Response: {"app_token":"qwerty123456","adid":"8d5244592279f8fd6d2d974281b178ae","timestamp":"2019-05-31T19:21:27.672Z+0000","message":"Session tracked"}
2019-05-31 16:21:26.963 2609-2718/com.adjustexample I/Adjust: Session tracked
2019-05-31 16:21:26.964 2609-2714/com.adjustexample D/Adjust: Wrote Package queue: []
2019-05-31 16:21:26.964 2609-2714/com.adjustexample D/Adjust: Package handler wrote 0 packages
2019-05-31 16:21:26.964 2609-2714/com.adjustexample V/Adjust: Package handler can send
2019-05-31 16:21:27.001 2609-2709/com.adjustexample D/Adjust: Wrote Activity state: ec:0 sc:2 ssc:1 sl:0.0 ts:0.0 la:11:12:13 uuid:cb773288-26d2-40e2-934c-69854dd13594

Android play-services-analytics - can't add without DexException

Hi,

Not sure if this is the best place, but in trying to use your sdk, I can't compile on Android and get this DexException:

Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/common/api/zzf;

From this build error (top bit for context):

:app:transformClassesWithDexForRelease

Running dex as a separate process.

To run dex in process, the Gradle daemon needs a larger heap.
It currently has 1024 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to at least 1536 MB.
To do this set org.gradle.jvmargs=-Xmx1536M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html


AGPBI: {"kind":"error","text":"Error converting bytecode to dex:\nCause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/common/api/zzf;","sources":[{}],"original":"UNEXPECTED TOP-LEVEL EXCEPTION:\ncom.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/common/api/zzf;\n\tat com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:591)\n\tat com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:546)\n\tat com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:528)\n\tat com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)\n\tat com.android.dx.merge.DexMerger.merge(DexMerger.java:188)\n\tat com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)\n\tat com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)\n\tat com.android.dx.command.dexer.Main.run(Main.java:277)\n\tat com.android.dx.command.dexer.Main.main(Main.java:245)\n\tat com.android.dx.command.Main.main(Main.java:106)\n","tool":"Dex"}

:app:transformClassesWithDexForRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 36.108 secs

This error ONLY occurs when I add the compile 'com.google.android.gms:play-services-analytics:10.0.1' line to the build gradle, comment it out and it goes away. I only add this because its required for this sdk as you specify in your README.

For context:

package.json

{
  "name": "example",
  "version": "0.5.0",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "android": "react-native run-android",
    "rev": "adb reverse tcp:8081 tcp:8081",
    "ios": "react-native run-ios --simulator='iPhone 7'",
    "release:android": "cd android && ./gradlew assembleRelease && cd ..",
    "cdapk": "cd android/app/build/outputs/apk",
    "lint": "eslint .",
    "test": "jest"
  },
  "dependencies": {
    "base-64": "^0.1.0",
    "chroma-js": "^1.2.1",
    "eslint-plugin-react": "^6.3.0",
    "lodash": "^4.16.4",
    "moment": "^2.16.0",
    "react": "~15.4.0-rc.4",
    "react-native": "0.38.0",
    "react-native-adjust": "^4.11.3",
    "react-native-animatable": "^0.6.1",
    "react-native-camera": "^0.4.1",
    "react-native-dialogs": "0.0.19",
    "react-native-fbsdk": "^0.4.0",
    "react-native-fcm": "^2.5.5",
    "react-native-image-picker": "^0.23.0",
    "react-native-keyboard-aware-scroll-view": "^0.2.8",
    "react-native-mimetype": "0.0.7",
    "react-native-modal-picker": "0.0.16",
    "react-native-navbar": "^1.5.4",
    "react-native-popup-menu": "^0.7.5",
    "react-native-router-flux": "^3.35.0",
    "react-native-scrollable-tab-view": "0.6.0",
    "react-native-search-bar": "^2.16.0",
    "react-native-swiper": "^1.5.4",
    "react-native-tabs": "^1.0.9",
    "react-native-vector-icons": "^3.0.0",
    "react-native-version-number": "^0.1.2",
    "react-redux": "^4.4.5",
    "realm": "^0.14.3",
    "redux": "^3.6.0",
    "redux-logger": "^2.6.1",
    "redux-saga": "^0.12.1",
    "z-schema": "^3.18.0"
  },
  "devDependencies": {
    "babel-jest": "17.0.2",
    "babel-preset-react-native": "1.9.0",
    "eslint": "^3.6.1",
    "eslint-plugin-react": "^6.3.0",
    "jest": "17.0.3",
    "jest-react-native": "17.0.3",
    "react-test-renderer": "~15.4.0-rc.4",
    "redux-devtools": "^3.3.1",
    "remote-redux-devtools": "^0.5.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

build.gradle

apply plugin: "com.android.application"

import com.android.build.OutputFile

/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
 * bundle directly from the development server. Below you can see all the possible configurations
 * and their defaults. If you decide to add a configuration block, make sure to add it before the
 * `apply from: "../../node_modules/react-native/react.gradle"` line.
 *
 * project.ext.react = [
 *   // the name of the generated asset file containing your JS bundle
 *   bundleAssetName: "index.android.bundle",
 *
 *   // the entry file for bundle generation
 *   entryFile: "index.android.js",
 *
 *   // whether to bundle JS and assets in debug mode
 *   bundleInDebug: false,
 *
 *   // whether to bundle JS and assets in release mode
 *   bundleInRelease: true,
 *
 *   // whether to bundle JS and assets in another build variant (if configured).
 *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
 *   // The configuration property can be in the following formats
 *   //         'bundleIn${productFlavor}${buildType}'
 *   //         'bundleIn${buildType}'
 *   // bundleInFreeDebug: true,
 *   // bundleInPaidRelease: true,
 *   // bundleInBeta: true,
 *
 *   // the root of your project, i.e. where "package.json" lives
 *   root: "../../",
 *
 *   // where to put the JS bundle asset in debug mode
 *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
 *
 *   // where to put the JS bundle asset in release mode
 *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in debug mode
 *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in release mode
 *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
 *
 *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
 *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
 *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
 *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
 *   // for example, you might want to remove it from here.
 *   inputExcludes: ["android/**", "ios/**"],
 *
 *   // override which node gets called and with what additional arguments
 *   nodeExecutableAndArgs: ["node"]
 *
 *   // supply additional arguments to the packager
 *   extraPackagerArgs: []
 * ]
 */

apply from: "../../node_modules/react-native/react.gradle"

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.1"

    defaultConfig {
        applicationId "example.app"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        //multiDexEnabled true
    }
    //dexOptions {
    //    preDexLibraries = false
    //}
    signingConfigs {
        release {
            storeFile file(MYAPP_RELEASE_STORE_FILE)
            storePassword MYAPP_RELEASE_STORE_PASSWORD
            keyAlias MYAPP_RELEASE_KEY_ALIAS
            keyPassword MYAPP_RELEASE_KEY_PASSWORD
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

repositories {
    mavenCentral()
    maven { url "https://jitpack.io" }
}

dependencies {
    compile project(':react-native-adjust')
    compile project(':react-native-version-number')
    compile project(':react-native-fcm')
    compile project(':react-native-fbsdk')
    compile project(':react-native-dialogs')
    compile project(':react-native-image-picker')
    compile project(':react-native-camera')
    compile project(':realm')
    compile project(':react-native-vector-icons')
    compile 'com.google.firebase:firebase-core:10.0.1' //this decides your firebase SDK version
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    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-analytics:10.0.1'
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
  from configurations.compile
  into 'libs'
}
apply plugin: 'com.google.gms.google-services'

Event not getting listed on dashboard

Hi,

The SDK is set up and i do see the version and the sdk enabled return true. And I have created an event and trying to log it using it s token as mentioned in the docs. But i don't find it on the dashboard. Not sure if is getting logged or no as u don't see any exceptions.

Kindly some one help me with this....

Are there any plans to update buildToolsVersion?

Since all existing Android apps have to support targetSDKVersion: 26, ReactNative 0.56 updates the targetSDKVersion along with buildToolsVersion as well. All libraries need to be updated to support at least buildToolsVersion 25. I would suggest matching it with versions set in ReactNative.

https://github.com/facebook/react-native/blob/v0.56.1/ReactAndroid/build.gradle#L249

Are there any plans to do this?

FYI, New apps deadline was August and any existing apps must update to targetSDKVersion 26 by November if they want to push any updates.

Feature request: bridge the Adjust.convertUniversalLink method

Hello,

Under iOS, when launching a universal link while the app is closed, the native continueUserActivity() method is called before the JS bundle is loaded. Therefore, the React Native's linking listener is never fired (Linking.addEventListener).

The initial URL can be read with Linking.getInitialURL, but in the case of universal links, the raw URL needs further processing by the Adjust SDK.

The only way (without duplicating code) to do that is to bridge the Adjust SDK's convertUniversalLink() method in order to make it accessible JS-side.

I can do it if you guys accept PRs.

Thanks,
Elyes

iOS install fails with `Native module cannot be null`

After installation of the Adjust, build fails with "Native module cannot be null." Linking seems to be fine:

 react-native link react-native-adjust
rnpm-install info Linking react-native-adjust ios dependency
rnpm-install info Platform 'ios' module react-native-adjust has been successfully linked
rnpm-install info Linking react-native-adjust android dependency
rnpm-install info Platform 'android' module react-native-adjust has been successfully linked
rnpm-install info Linking assets to ios project
rnpm-install info Linking assets to android project
rnpm-install info Assets have been successfully linked to your project

Versions:

    "react-native": "0.57.7",
    "react-native-adjust": "^4.17.0",

Please suggest what could be wrong.

Use api instead of implementation in build.gradle

Adjust 4.17 changed the compile keyword in build.gradle to implementation. That should have been changed to api not implementation. Our react native project no longer compile after upgrading from 4.15 to 4.17. Locally patching the package to use api resolves the issue.

This was from:

#47

Native module cannot be null

When I run the application in Debug mode i have an instant crash in node_modules/react-native-adjust/index.js @ line number 15.

The issue seems to be this line. It works fine in release/staging but debug seems not functional.
module_adjust_emitter = new NativeEventEmitter(NativeModules.AdjustEventEmitter);

This issue is with ios.

Give duplicate files error when running as Android app

Duplicate class com.adjust.sdk.ActivityHandler found in modules adjust-android-4.21.2.jar (com.adjust.sdk:adjust-android:4.21.2) and adjust-android.jar (adjust-android.jar)
Duplicate class com.adjust.sdk.ActivityHandler$1 found in modules adjust-android-4.21.2.jar (com.adjust.sdk:adjust-android:4.21.2) and adjust-android.jar (adjust-android.jar)
Duplicate class com.adjust.sdk.ActivityHandler$10 found in modules adjust-android-4.21.2.jar (com.adjust.sdk:adjust-android:4.21.2) and adjust-android.jar (adjust-android.jar)
Duplicate class com.adjust.sdk.ActivityHandler$11 found in modules adjust-android-4.21.2.jar (com.adjust.sdk:adjust-android:4.21.2) and adjust-android.jar (adjust-android.jar)
Duplicate class com.adjust.sdk.ActivityHandler$12 found in modules adjust-android-4.21.2.jar (com.adjust.sdk:adjust-android:4.21.2) and adjust-android.jar (adjust-android.jar)
Duplicate class com.adjust.sdk.ActivityHandler$13 found in modules adjust-android-4.21.2.jar (com.adjust.sdk:adjust-android:4.21.2) and adjust-android.jar (adjust-android.jar)
Duplicate class com.adjust.sdk.ActivityHandler$14 found in modules adjust-android-4.21.2.jar (com.adjust.sdk:adjust-android:4.21.2) and adjust-android.jar (adjust-android.jar)
Duplicate class com.adjust.sdk.ActivityHandler$15 found in modules adjust-android-4.21.2.jar (com.adjust.sdk:adjust-android:4.21.2) and adjust-android.jar (adjust-android.jar)
....

Continue with above error for several files.

Deeplink reattribution doesn't work

I've set deeplinking in my app but the problem is that reattribution doesn't work when a user opens the app via deeplink.
The url goes to handleDeepLink(event) method, however i'm not sure that Adjust.appWillOpenUrl(event.url) method works.

constructor(props) {
super(props);
Adjust.getSdkVersion(function (sdkVersion) {
console.log("Adjust SDK version: " + sdkVersion);
});

   // const adjustConfig = new AdjustConfig("KEY", AdjustConfig.EnvironmentSandbox);
    const adjustConfig = new AdjustConfig("KEY", AdjustConfig.EnvironmentProduction);
    adjustConfig.setLogLevel(AdjustConfig.LogLevelVerbose);
    adjustConfig.setShouldLaunchDeeplink(true);
    adjustConfig.setSendInBackground(true);

    adjustConfig.setDelayStart(4.0);

    adjustConfig.setAttributionCallbackListener(function (attribution) {
        console.log(">>> Attribution callback received");

        console.log("Tracker token = " + attribution.trackerToken);
        console.log("Tracker name = " + attribution.trackerName);
        console.log("Network = " + attribution.network);
        console.log("Campaign = " + attribution.campaign);
        console.log("Adgroup = " + attribution.adgroup);
        console.log("Creative = " + attribution.creative);
        console.log("Click label = " + attribution.clickLabel);
        console.log("Adid = " + attribution.adid);
    });

    adjustConfig.setDeferredDeeplinkCallbackListener(function(deeplink) {
        console.log("Deferred deep link URL content: " + deeplink);
    });

    adjustConfig.setDelayStart(4.0);

    Adjust.addSessionCallbackParameter("scpk1", "scpv1");

    Adjust.create(adjustConfig);
}

_trackFormSentEvent() {
    const adjustEvent = new AdjustEvent("KEY");
    Adjust.trackEvent(adjustEvent);
}

_trackNewSessionEvent() {
    const adjustEvent = new AdjustEvent("KEY");

    Adjust.trackEvent(adjustEvent);
}

async componentDidMount() {
    Linking.addEventListener('url', this.handleDeepLink);
    Linking.getInitialURL().then((url) => {
        if (url) {
            this.handleDeepLink({ url });
        }
    }).catch(e => console.log(e))
}


componentWillUnmount() {
    Linking.removeEventListener('url', this.handleDeepLink);
}

handleDeepLink(event) {
    Adjust.appWillOpenUrl(event.url);
}

How should this be integrated with React Native Navigation?

I'm currently working on an app using React Native Navigation and am having some trouble with your integration instructions.

The instructions say to use ComponentWillMount and ComponentWillUnmount in index.js. However React Native Navigation doesn't have a root component for those to be used in.

Do you have a recommended way to use your SDK with React Native Navigation?

Used in China

In China, whether you will file the domain name, or will be restricted access, such as WeChat on

Typings for Typescript users

This lib is missing typings. After taking a quick peek at the source, it seems like it would be pretty easy to add given how straightforward the API is.

adjust ios build fail

ld: library not found for -lAdjust
clang: error: linker command failed with exit code 1 (use -v to see invocation)

TypeScript definitions not constructed properly

The current .d.ts file generates 57 errors when building with TS 2.9+ (not tested on older versions). The file is simply not constructed correctly. PR on the way.

Here are the errors:

node_modules/react-native-adjust/index.d.ts:64:65 - error TS1183: An implementation cannot be declared in ambient contexts.

64         constructor(appToken: string, environment: Environment) { }
                                                                   ~

node_modules/react-native-adjust/index.d.ts:66:51 - error TS1183: An implementation cannot be declared in ambient contexts.

66         public setLogLevel(level: LogLevel): void { }
                                                     ~

node_modules/react-native-adjust/index.d.ts:68:67 - error TS1183: An implementation cannot be declared in ambient contexts.

68         public setEventBufferingEnabled(isEnabled: boolean): void { }
                                                                     ~

node_modules/react-native-adjust/index.d.ts:70:58 - error TS1183: An implementation cannot be declared in ambient contexts.

70         public setProcessName(processName: string): void { }
                                                            ~

node_modules/react-native-adjust/index.d.ts:72:64 - error TS1183: An implementation cannot be declared in ambient contexts.

72         public setDefaultTracker(defaultTracked: string): void { }
                                                                  ~

node_modules/react-native-adjust/index.d.ts:74:54 - error TS1183: An implementation cannot be declared in ambient contexts.

74         public setUserAgent(userAgent: string): void { }
                                                        ~

node_modules/react-native-adjust/index.d.ts:76:113 - error TS1183: An implementation cannot be declared in ambient contexts.

76         public setAppSecret(secretId: number, info1: number, info2: number, info3: number, info4: number): void { }
                                                                                                                   ~

node_modules/react-native-adjust/index.d.ts:78:56 - error TS1183: An implementation cannot be declared in ambient contexts.

78         public setDelayStart(delayStart: number): void { }
                                                          ~

node_modules/react-native-adjust/index.d.ts:80:69 - error TS1183: An implementation cannot be declared in ambient contexts.

80         public setSendInBackground(sendInBackground: boolean): void { }
                                                                       ~

node_modules/react-native-adjust/index.d.ts:82:61 - error TS1183: An implementation cannot be declared in ambient contexts.

82         public setDeviceKnown(isDeviceKnown: boolean): void { }
                                                               ~

node_modules/react-native-adjust/index.d.ts:84:54 - error TS1183: An implementation cannot be declared in ambient contexts.

84         public setSdkPrefix(sdkPrefix: string): void { }
                                                        ~

node_modules/react-native-adjust/index.d.ts:86:77 - error TS1183: An implementation cannot be declared in ambient contexts.

86         public setShouldLaunchDeeplink(shouldLaunchDeeplink: boolean): void { }
                                                                               ~

node_modules/react-native-adjust/index.d.ts:88:105 - error TS1183: An implementation cannot be declared in ambient contexts.

88         public setAttributionCallbackListener(callback: (attribution: AdjustAttribution) => void): void { }
                                                                                                           ~

node_modules/react-native-adjust/index.d.ts:90:126 - error TS1183: An implementation cannot be declared in ambient contexts.

90         public setEventTrackingSucceededCallbackListener(callback: (eventSuccess: AdjustEventTrackingSuccess) => void): void { }
                                                                                                                                ~

node_modules/react-native-adjust/index.d.ts:92:122 - error TS1183: An implementation cannot be declared in ambient contexts.

92         public setEventTrackingFailedCallbackListener(callback: (eventFailed: AdjustEventTrackingFailure) => void): void { }
                                                                                                                            ~

node_modules/react-native-adjust/index.d.ts:94:132 - error TS1183: An implementation cannot be declared in ambient contexts.

94         public setSessionTrackingSucceededCallbackListener(callback: (sessionSuccess: AdjustSessionTrackingSuccess) => void): void { }
                                                                                                                                      ~

node_modules/react-native-adjust/index.d.ts:96:128 - error TS1183: An implementation cannot be declared in ambient contexts.

96         public setSessionTrackingFailedCallbackListener(callback: (sessionFailed: AdjustSessionTrackingFailure) => void): void { }
                                                                                                                                  ~

node_modules/react-native-adjust/index.d.ts:98:94 - error TS1183: An implementation cannot be declared in ambient contexts.

98         public setDeferredDeeplinkCallbackListener(callback: (uri: AdjustUri) => void): void { }
                                                                                                ~

node_modules/react-native-adjust/index.d.ts:100:20 - error TS1086: An accessor cannot be declared in an ambient context.

100         static get LogLevelVerbose(): LogLevel {
                       ~~~~~~~~~~~~~~~

node_modules/react-native-adjust/index.d.ts:104:20 - error TS1086: An accessor cannot be declared in an ambient context.

104         static get LogLevelDebug(): LogLevel {
                       ~~~~~~~~~~~~~

node_modules/react-native-adjust/index.d.ts:108:20 - error TS1086: An accessor cannot be declared in an ambient context.

108         static get LogLevelInfo(): LogLevel {
                       ~~~~~~~~~~~~

node_modules/react-native-adjust/index.d.ts:112:20 - error TS1086: An accessor cannot be declared in an ambient context.

112         static get LogLevelWarn(): LogLevel {
                       ~~~~~~~~~~~~

node_modules/react-native-adjust/index.d.ts:116:20 - error TS1086: An accessor cannot be declared in an ambient context.

116         static get LogLevelError(): LogLevel {
                       ~~~~~~~~~~~~~

node_modules/react-native-adjust/index.d.ts:120:20 - error TS1086: An accessor cannot be declared in an ambient context.

120         static get LogLevelAssert(): LogLevel {
                       ~~~~~~~~~~~~~~

node_modules/react-native-adjust/index.d.ts:124:20 - error TS1086: An accessor cannot be declared in an ambient context.

124         static get LogLevelSuppress(): LogLevel {
                       ~~~~~~~~~~~~~~~~

node_modules/react-native-adjust/index.d.ts:128:20 - error TS1086: An accessor cannot be declared in an ambient context.

128         static get EnvironmentSandbox(): Environment {
                       ~~~~~~~~~~~~~~~~~~

node_modules/react-native-adjust/index.d.ts:132:20 - error TS1086: An accessor cannot be declared in an ambient context.

132         static get EnvironmentProduction(): Environment {
                       ~~~~~~~~~~~~~~~~~~~~~

node_modules/react-native-adjust/index.d.ts:138:41 - error TS1183: An implementation cannot be declared in ambient contexts.

138         constructor(eventToken: string) { }
                                            ~

node_modules/react-native-adjust/index.d.ts:140:68 - error TS1183: An implementation cannot be declared in ambient contexts.

140         public setRevenue(revenue: number, currency: string): void { }
                                                                       ~

node_modules/react-native-adjust/index.d.ts:142:71 - error TS1183: An implementation cannot be declared in ambient contexts.

142         public addCallbackParameter(key: string, value: string): void { }
                                                                          ~

node_modules/react-native-adjust/index.d.ts:144:70 - error TS1183: An implementation cannot be declared in ambient contexts.

144         public addPartnerParameter(key: string, value: string): void { }
                                                                         ~

node_modules/react-native-adjust/index.d.ts:146:62 - error TS1183: An implementation cannot be declared in ambient contexts.

146         public setTransactionId(transactionId: string): void { }
                                                                 ~

node_modules/react-native-adjust/index.d.ts:148:56 - error TS1183: An implementation cannot be declared in ambient contexts.

148         public setCallbackId(callbackId: string): void { }
                                                           ~

node_modules/react-native-adjust/index.d.ts:151:27 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

151     export const Adjust = {
                              ~
152         componentWillUnmount: (): void => { },
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... 
174         setReferrer: (referrer: string): void => { },
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
175     };
    ~~~~~

node_modules/react-native-adjust/index.d.ts:152:43 - error TS1183: An implementation cannot be declared in ambient contexts.

152         componentWillUnmount: (): void => { },
                                              ~

node_modules/react-native-adjust/index.d.ts:153:55 - error TS1183: An implementation cannot be declared in ambient contexts.

153         create: (adjustConfig: AdjustConfig): void => { },
                                                          ~

node_modules/react-native-adjust/index.d.ts:154:57 - error TS1183: An implementation cannot be declared in ambient contexts.

154         trackEvent: (adjustEvent: AdjustEvent): void => { },
                                                            ~

node_modules/react-native-adjust/index.d.ts:155:49 - error TS1183: An implementation cannot be declared in ambient contexts.

155         setEnabled: (enabled: boolean): void => { },
                                                    ~

node_modules/react-native-adjust/index.d.ts:156:68 - error TS1183: An implementation cannot be declared in ambient contexts.

156         isEnabled: (callback: (enabled: boolean) => void): void => { },
                                                                       ~

node_modules/react-native-adjust/index.d.ts:157:53 - error TS1183: An implementation cannot be declared in ambient contexts.

157         setOfflineMode: (enabled: boolean): void => { },
                                                        ~

node_modules/react-native-adjust/index.d.ts:158:48 - error TS1183: An implementation cannot be declared in ambient contexts.

158         setPushToken: (token: string): void => { },
                                                   ~

node_modules/react-native-adjust/index.d.ts:159:48 - error TS1183: An implementation cannot be declared in ambient contexts.

159         appWillOpenUrl: (url: string): void => { },
                                                   ~

node_modules/react-native-adjust/index.d.ts:160:40 - error TS1183: An implementation cannot be declared in ambient contexts.

160         sendFirstPackages: (): void => { },
                                           ~

node_modules/react-native-adjust/index.d.ts:161:76 - error TS1183: An implementation cannot be declared in ambient contexts.

161         addSessionCallbackParameter: (key: string, value: string): void => { },
                                                                               ~

node_modules/react-native-adjust/index.d.ts:162:75 - error TS1183: An implementation cannot be declared in ambient contexts.

162         addSessionPartnerParameter: (key: string, value: string): void => { },
                                                                              ~

node_modules/react-native-adjust/index.d.ts:163:64 - error TS1183: An implementation cannot be declared in ambient contexts.

163         removeSessionCallbackParameter: (key: string): void => { },
                                                                   ~

node_modules/react-native-adjust/index.d.ts:164:63 - error TS1183: An implementation cannot be declared in ambient contexts.

164         removeSessionPartnerParameter: (key: string): void => { },
                                                                  ~

node_modules/react-native-adjust/index.d.ts:165:53 - error TS1183: An implementation cannot be declared in ambient contexts.

165         resetSessionCallbackParameters: (): void => { },
                                                        ~

node_modules/react-native-adjust/index.d.ts:166:52 - error TS1183: An implementation cannot be declared in ambient contexts.

166         resetSessionPartnerParameters: (): void => { },
                                                       ~

node_modules/react-native-adjust/index.d.ts:167:35 - error TS1183: An implementation cannot be declared in ambient contexts.

167         gdprForgetMe: (): void => { },
                                      ~

node_modules/react-native-adjust/index.d.ts:168:62 - error TS1183: An implementation cannot be declared in ambient contexts.

168         getIdfa: (callback: (idfa: string) => void): void => { },
                                                                 ~

node_modules/react-native-adjust/index.d.ts:169:68 - error TS1183: An implementation cannot be declared in ambient contexts.

169         getGoogleAdId: (callback: (adid: string) => void): void => { },
                                                                       ~

node_modules/react-native-adjust/index.d.ts:170:62 - error TS1183: An implementation cannot be declared in ambient contexts.

170         getAdid: (callback: (adid: string) => void): void => { },
                                                                 ~

node_modules/react-native-adjust/index.d.ts:171:87 - error TS1183: An implementation cannot be declared in ambient contexts.

171         getAttribution: (callback: (attribution: AdjustAttribution) => void): void => { },
                                                                                          ~

node_modules/react-native-adjust/index.d.ts:172:68 - error TS1183: An implementation cannot be declared in ambient contexts.

172         getAmazonAdId: (callback: (adid: string) => void): void => { },
                                                                       ~

node_modules/react-native-adjust/index.d.ts:173:74 - error TS1183: An implementation cannot be declared in ambient contexts.

173         getSdkVersion: (callback: (sdkVersion: string) => void): void => { },
                                                                             ~

node_modules/react-native-adjust/index.d.ts:174:50 - error TS1183: An implementation cannot be declared in ambient contexts.

174         setReferrer: (referrer: string): void => { },
                                                     ~


Found 57 errors.

[Unhandled promise rejection: TypeError: undefined is not an object (evaluating 'module_adjust.create')]

It works well on iOS side, but I am getting error on Android.

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

mainapplication.java

...
import com.adjust.nativemodule.AdjustPackage;

public class MainApplication extends ExpoApplication {

@OverRide
public boolean isDebug() {
return BuildConfig.DEBUG;
}

// Needed for react-native link
public List getPackages() {
return Arrays.asList(
// Add your own packages here!
// TODO: add native modules!

    // Needed for `react-native link`
    // new MainReactPackage(),
        new VectorIconsPackage(),
        new PinchPackage(),
        new LinearGradientPackage(),
        new RNIapPackage(),
        new AdjustPackage()
);

}
...

// adjust sdk
const adjustConfig = new AdjustConfig (
ADJUST_APP_TOKEN,
AdjustConfig.EnvironmentProduction
);
Adjust.create (adjustConfig);

Add instructions on how to ensure SDK is properly installed

It'd be helpful if there were some instructions on how to ensure that once I've installed the SDK it is correctly reporting to Adjust.

Right now there are instructions to install the SDK and then there's a wall of text of additional things that need to be done specific to Android and iOS, but I don't even know if the basic install can communicate with Adjust.

React Native SDK Release Containing IOS 4.21.3

Any chance we can get a release pushed to npm that updates the IOS pod spec to 4.21.3 to match the latest release IOS SDK release on https://github.com/adjust/ios_sdk/releases.

For background we just updated from RN Adjust 4.18.2 to 4.21 and started seeing the following crash:

EXC_BAD_ACCESS Attempted to dereference garbage pointer 0x38. 
    /usr/lib/system/libdispatch.dylib __dispatch_source_set_handler
    NewWordsWithFriends/Pods/Adjust/Adjust/ADJTimerOnce.m:92:5 -[ADJTimerOnce startIn:]
    NewWordsWithFriends/Pods/Adjust/Adjust/ADJAdditions/UIDevice+ADJAdditions.m:224:9 -[UIDevice(ADJAdditions) setiAdWithDetails:adcClientSharedInstance:iAdTimeoutTimer:]
    NewWordsWithFriends/Pods/Adjust/Adjust/ADJAdditions/UIDevice+ADJAdditions.m:194:36 -[UIDevice(ADJAdditions) adjCheckForiAd:iAdTimeoutTimer:]
    NewWordsWithFriends/Pods/Adjust/Adjust/ADJActivityHandler.m:1337:5 -[ADJActivityHandler checkForiAdI:]
    NewWordsWithFriends/Pods/Adjust/Adjust/ADJActivityHandler.m:799:9 -[ADJActivityHandler initI:preLaunchActionsArray:]
    NewWordsWithFriends/Pods/Adjust/Adjust/ADJActivityHandler.m:214:26 __52-[ADJActivityHandler initWithConfig:savedPreLaunch:]_block_invoke_2
    NewWordsWithFriends/Pods/Adjust/Adjust/ADJUtil.m:1240:9 __42+[ADJUtil launchInQueue:selfInject:block:]_block_invoke
    /usr/lib/system/libdispatch.dylib __dispatch_call_block_and_release
    /usr/lib/system/libdispatch.dylib __dispatch_client_callout
    /usr/lib/system/libdispatch.dylib __dispatch_lane_serial_drain$VARIANT$armv81
    /usr/lib/system/libdispatch.dylib __dispatch_lane_invoke$VARIANT$armv81
    /usr/lib/system/libdispatch.dylib __dispatch_workloop_worker_thread
    /usr/lib/system/libsystem_pthread.dylib __pthread_wqthread

We think it might be fixed in IOS 4.21.3

[support] ios install fail `native module cannot be null`

Hey guys, the npm & react-native link install in the readme didn't quite fly on my environment.

similar issue: #34

I got the native module cannot be null right off the bat. After debugging I noticed the native module was missing and assumed it to be a config/install/link error.

After that I tried doing pods but it messed the whole thing up. 🤔
Currently rolled back to a stable state and will try again tomorrow.

if I add the package thru npm, it doesn't depend on pods in any way, right? I tried linking manually but didn't see a .framework listed in xcode 🤔

Any help is appreciated.

npm v6.4.1
node v11.3.0

"dependencies": {
    "@expo/react-native-action-sheet": "1.0.2",
    "babel-plugin-transform-decorators-legacy": "1.3.4",
    "babel-plugin-transform-remove-console": "6.8.5",
    "bugsnag-react-native": "2.7.0",
    "ethereum-regex": "1.1.3",
    "immutability-helper": "2.4.0",
    "instabug-reactnative": "8.0.12",
    "lodash": "4.17.4",
    "moment": "2.18.1",
    "numeral": "2.0.6",
    "re-reselect": "1.0.1",
    "react": "16.0.0",
    "react-native": "0.51.0",
    "react-native-adjust": "4.17.0",
    "react-native-android-keyboard-adjust": "1.1.1",
    "react-native-camera": "1.1.2",
    "react-native-charts-wrapper": "0.4.3",
    "react-native-device-info": "0.21.5",
    "react-native-fbsdk": "0.7.0",
    "react-native-gesture-recognizers": "git://[email protected]:rdy/react-native-gesture-recognizers.git",
    "react-native-iphone-x-helper": "1.0.2",
    "react-native-keyboard-aware-scroll-view": "0.5.0",
    "react-native-keyboard-manager": "4.0.13-5",
    "react-native-linear-gradient": "2.4.0",
    "react-native-masked-text": "1.6.4",
    "react-native-mixpanel": "git://[email protected]:gabrieletondi/react-native-mixpanel.git",
    "react-native-onesignal": "3.0.7",
    "react-native-popup-menu": "0.12.2",
    "react-native-qrcode-scanner": "1.0.1",
    "react-native-safe-area-view": "0.6.0",
    "react-native-size-matters": "0.1.0",
    "react-native-splash-screen": "3.1.1",
    "react-native-swipeout": "2.3.1",
    "react-native-touch-id": "4.0.3",
    "react-native-vector-icons": "4.4.0",
    "react-native-walkthrough-tooltip": "0.2.0",
    "react-native-xml2js": "1.0.3",
    "react-navigation": "1.0.0-beta.13",
    "react-redux": "5.0.5",
    "redux": "3.7.1",
    "redux-actions": "2.2.1",
    "redux-saga": "0.15.4",
    "redux-storage": "4.1.2",
    "redux-storage-decorator-debounce": "1.1.3",
    "redux-storage-decorator-filter": "1.1.8",
    "redux-storage-engine-reactnativeasyncstorage": "1.0.5",
    "reselect": "3.0.1",
    "socket.io": "2.0.3",
    "validate.js": "0.12.0",
    "why-did-you-update": "0.1.0"
  },
  "devDependencies": {
    "@storybook/addon-actions": "3.2.10",
    "@storybook/addon-links": "3.2.10",
    "@storybook/react-native": "3.2.10",
    "babel-eslint": "7.1.0",
    "babel-jest": "18.0.0",
    "babel-preset-react-native": "2.0.0",
    "eslint": "3.9.1",
    "eslint-config-airbnb": "12.0.0",
    "eslint-plugin-flowtype": "2.25.0",
    "eslint-plugin-import": "1.16.0",
    "eslint-plugin-jsx-a11y": "2.2.3",
    "eslint-plugin-react": "6.6.0",
    "flow-bin": "0.45.0",
    "jest": "21.2.1",
    "prop-types": "15.6.0",
    "react-dom": "16.0.0-alpha.12",
    "react-test-renderer": "15.4.2"

Which version of Adjust Native SDK?

Hello,

It's unclear from the README which version of the Adjust native library is used with this package.

Adjust SDK version 2 (V2) is being sunset on May 15th. So would like confirmation that react-native-sdk is including a more recent version if possible.

Thanks a lot.

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.