I've followed the documents, I don't know what's wrong, I would really appreciate some insight.
Manifest:
<uses-permission android:name="android.permission.INTERNET" />
<application
...
android:name="io.branch.referral.BranchApp">
<meta-data android:name="io.branch.sdk.BranchKey" android:value="key_live_123456789asdf" />
<activity
...>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="indexed_on_SEO">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="http"
android:host="www.schoolminder.info"
android:pathPrefix="/home"/>
</intent-filter>
<intent-filter>
<data
android:scheme="http"
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>
</application>
The activity
@Override
protected void onStart() {
super.onStart();
Branch branch = Branch.getInstance();
branch.initSession(new Branch.BranchReferralInitListener(){
@Override
public void onInitFinished(JSONObject referringParams, BranchError error) {
if (error == null) {
Log.i("MyApp", "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);
}
@Override
protected void onNewIntent(Intent intent) {
this.setIntent(intent);
}
The fragment when the invitation is made:
BranchUniversalObject branchUniversalObject = new BranchUniversalObject()
.setCanonicalIdentifier("item/12345")
.setContentIndexingMode(BranchUniversalObject.CONTENT_INDEX_MODE.PUBLIC)
.addContentMetadata("property1", "blue")
.addContentMetadata("property2", "red");
LinkProperties linkProperties = new LinkProperties()
.setChannel("facebook")
.setFeature("sharing");
branchUniversalObject.generateShortUrl(getActivity(), linkProperties, new Branch.BranchLinkCreateListener() {
@Override
public void onLinkCreate(String url, BranchError error) {
if (error == null) {
link = url;
}
}
});
Branch.getInstance(getActivity().getApplicationContext()).loadRewards(new Branch.BranchReferralStateChangedListener() {
@Override
public void onStateChanged(boolean changed, BranchError error) {
int credits = Branch.getInstance().getCredits();
Branch.getInstance().redeemRewards(credits);
Log.i("MyApp", credits+"");
}
});
I dealt with the links for each platform on the Branch Dashboard settings.
What's happening is, when I send this link to someone, it opens the Play Store as expected and he can download it, but I don't get the credits, and it doesn't show any Referred users not Influencers so I must be doing something wrong.