我已經按照文檔,我不知道什麼是錯的,我會非常感謝一些見解。如何使用Branch.io實現推薦系統
清單:
<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>
活性
@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);
}
當邀請是由該片段:
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+"");
}
});
我處理了分支儀表板設置中每個平臺的鏈接。
發生什麼事情是,當我將此鏈接發送給某人時,它按預期打開Play商店,他可以下載它,但我沒有獲得信用,並且不顯示任何推薦用戶而不是影響者我一定做錯了什麼。
亞歷克斯從分支這裏:@portfoliobuilder,感謝您的偉大答案!這種行爲也可能是由我們圍繞推介的反欺詐系統造成的。我們有一個[調試模式](https://dev.branch.io/getting-started/integration-testing/guide/ios/#use-debug-mode-to-simulate-fresh-installs)來幫助解決這個問題。這些問題很難解決,所以最簡單的選擇可能是提交一個[集成票](https://support.branch.io/support/tickets/new),這樣我們的團隊就可以在後端挖掘。 –