Advertisement
snegir

bracnh afrika

Dec 19th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. Add this to your main Activity file:
  2.  
  3.  
  4. @Override
  5. public void onStart() {
  6. super.onStart();
  7. Branch branch = Branch.getInstance();
  8.  
  9. // Branch init
  10. branch.initSession(new Branch.BranchReferralInitListener() {
  11. @Override
  12. public void onInitFinished(JSONObject referringParams, BranchError error) {
  13. if (error == null) {
  14. // params are the deep linked params associated with the link that the user clicked -> was re-directed to this app
  15. // params will be empty if no data found
  16. // ... insert custom logic here ...
  17. Log.i("BRANCH SDK", referringParams.toString());
  18. } else {
  19. Log.i("BRANCH SDK", error.getMessage());
  20. }
  21. }
  22. }, this.getIntent().getData(), this);
  23. }
  24.  
  25. @Override
  26. public void onNewIntent(Intent intent) {
  27. this.setIntent(intent);
  28. }
  29.  
  30.  
  31.  
  32. Enable Auto Session Management
  33. Add this to your custom Application class file:
  34.  
  35.  
  36. public final class CustomApplicationClass extends Application {
  37. @Override
  38. public void onCreate() {
  39. super.onCreate();
  40.  
  41. // Initialize the Branch object
  42. Branch.getAutoInstance(this);
  43. content_copy
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement