Advertisement
shmoula

Untitled

Jan 6th, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.19 KB | None | 0 0
  1. public class AppsFlyerUtils implements AppsFlyerConversionListener {
  2.     private static AppsFlyerLib sTracker;
  3.     private static AppsFlyerUtils sInstance;
  4.     private static WeakReference<Context> mContextReference;
  5.  
  6.     private AppsFlyerUtils(Application application, boolean debug) {
  7.         mContextReference = new WeakReference<>(application.getApplicationContext());
  8.  
  9.         if (sTracker == null) {
  10.           sTracker = AppsFlyerLib.getInstance();
  11.         }
  12.  
  13.         sTracker.setGCMProjectNumber(mContextReference.get(), App.getResString(R.string.appsflyer_server_api_key));
  14.         sTracker.startTracking(application, App.getResString(R.string.appsflyer_dev_key));
  15.         sTracker.registerConversionListener(mContextReference.get(), this);
  16.  
  17.         . . .
  18.     }
  19.  
  20.     public static void initialize(Application application, boolean debug) {
  21.         if (sInstance == null) {
  22.             sInstance = new AppsFlyerUtils(application, debug);
  23.         }
  24.     }
  25.  
  26.     @Override
  27.     public void onInstallConversionDataLoaded(Map<String, String> map) {
  28.         // This gets called every time.
  29.     }
  30.  
  31.     @Override
  32.     public void onAppOpenAttribution(Map<String, String> map) {
  33.         // Never gets called.
  34.     }
  35.  
  36.     . . .
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement