-1

io to make a referral program for my android app.I integrated according to branch documentation described here https://dev.branch.io/getting-started/sdk-integration-guide/guide/android/

And install tracking and giving reward to user is working fine but if i install using a user referral link it do not work.it do not give reward to Influencers.

Here my code

In manifest

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    android:name="io.branch.referral.BranchApp"
    >

    <activity android:name="com.video.watch.earn.ActivityMain"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <data android:scheme="videotopro" android:host="open" />
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>
    </activity>

    <receiver android:name="io.branch.referral.InstallListener" android:exported="true">
        <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
        </intent-filter>
    </receiver>

In java class MainActivity

//branch io

@Override
public void onStart() {
    super.onStart();
    final Branch branch = Branch.getInstance(getApplicationContext());

    branch.initSession(new Branch.BranchReferralInitListener(){
        @Override
        public void onInitFinished(JSONObject referringParams, BranchError error) {
            if (error == null) {
                // params are the deep linked params associated with the link that the user clicked -> was re-directed to this app
                // params will be empty if no data found
                // ... insert custom logic here ...
                Log.i("BranchConfigTest", "deep link data: " + referringParams.toString());
            } else {
                Log.i("MyApp", error.getMessage());
            }
        }
    }, this.getIntent().getData(), this);


    String userID = new BigInteger(130, new SecureRandom()).toString(32);
    branch.getInstance().setIdentity(userID);

    Branch.getInstance(this.getApplicationContext()).loadRewards(new Branch.BranchReferralStateChangedListener() {
        @Override
        public void onStateChanged(boolean changed, BranchError error) {
            int credits = branch.getCredits();
            Log.d("branch credit",""+credits);
        }
    });
}

@Override
public void onNewIntent(Intent intent) {
    this.setIntent(intent);
}

@Override
public void onStop() {
    super.onStop();
    Branch.getInstance().logout();
}


//branch io

And in my frament I am generating referral link which I share

BranchUniversalObject branchUniversalObject = new BranchUniversalObject()
            .setCanonicalIdentifier("item/12345")
            .setTitle("My Content Title")
            .setContentDescription("My Content Description")
            .setContentImageUrl("https://example.com/mycontent-12345.png")
            .setContentIndexingMode(BranchUniversalObject.CONTENT_INDEX_MODE.PUBLIC)
            .addContentMetadata("property1", "blue")
            .addContentMetadata("property2", "red");

    LinkProperties linkProperties = new LinkProperties()
            .setChannel("facebook")
            .setFeature("referral")
            .addControlParameter("$android_url", "http://hkpsourcing.com/vidcoin/app-release.apk");


    branchUniversalObject.generateShortUrl(getActivity(), linkProperties, new Branch.BranchLinkCreateListener() {
        @Override
        public void onLinkCreate(String url, BranchError error) {
            if (error == null) {
                Log.i("MyApp", "got my Branch link to share: " + url);
                refUrl=url;
            }
        }
    });

I made rule for referrer and referring user but when user install app using referral link it do not track influencers who refer him.

Cœur
  • 37,241
  • 25
  • 195
  • 267
shakac
  • 379
  • 4
  • 15

1 Answers1

0

Alex from Branch.io here:

If you're testing on the same devices, you will need to enable debug mode to trigger fresh installs for this. Otherwise, Branch detects that the app has previously been installed on the device and instead counts that as a reopen event to protect against fraud.

Alex Bauer
  • 13,147
  • 1
  • 27
  • 44
  • Hi Alex, i am trying the same thing and testing my app in debug mode but it still does not update the credit & i am uninstalling the app in the same device. In the dashboard, in LiveView tab it shows me the referred session but nothing happens in credit tab. – Gautam May 05 '17 at 13:25
  • @Gautam send a ticket in to our [Integrations team](https://support.branch.io/support/tickets/new), and they should be able to sort this out for you! – Alex Bauer May 06 '17 at 00:06
  • Thanks Alex for the quick response.Sure i will do that – Gautam May 06 '17 at 06:18