Back to project page android_sdk.
The source code is released under:
Copyright (c) 2012-2014 adjust GmbH, http://www.adjust.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Softw...
If you think the Android project android_sdk listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.adjust.sdk; /*w ww. j a v a 2s .c o m*/ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; import static com.adjust.sdk.Constants.ENCODING; import static com.adjust.sdk.Constants.MALFORMED; import static com.adjust.sdk.Constants.REFERRER; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; // support multiple BroadcastReceivers for the INSTALL_REFERRER: // http://blog.appington.com/2012/08/01/giving-credit-for-android-app-installs public class ReferrerReceiver extends BroadcastReceiver { protected static final String REFERRER_KEY = "AdjustInstallReferrer"; @Override public void onReceive(Context context, Intent intent) { String rawReferrer = intent.getStringExtra(REFERRER); if (null == rawReferrer) { return; } String referrer; try { referrer = URLDecoder.decode(rawReferrer, ENCODING); } catch (UnsupportedEncodingException e) { referrer = MALFORMED; } SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); preferences.edit().putString(REFERRER_KEY, referrer).commit(); } }