package com.appnexus.opensdk;

import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

import com.appnexus.opensdk.utils.Clog;
import com.appnexus.opensdk.utils.Settings;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

public class InstallTrackerPixel extends BroadcastReceiver{
	BroadcastReceiver receiver_install;
	Context context;
	
	
	//Test with am broadcast -a com.android.vending.INSTALL_REFERRER --es "referrer" "utm_source=test_source&utm_medium=test_medium&utm_term=test_term&utm_content=test_content&utm_campaign=test_name"
	//in adb
	public InstallTrackerPixel(){
		super();
	}

	@Override
	public void onReceive(Context context, final Intent intent) {
		this.context=context;
		Clog.error_context=context;
		final Bundle extras = intent.getExtras();
		
		new Thread(new Runnable(){

			@Override
			public void run() {
				String referralString = extras.getString("referrer");

				String url = getInstallUrl(referralString);
				
				
				Clog.d(Clog.baseLogTag, Clog.getString(R.string.conversion_pixel, url));
				
				try{
					HttpClient client = new DefaultHttpClient();
					HttpGet get = new HttpGet(url);
					client.execute(get);
					// TODO: what happens if it fails? what is the server response if it succeeds?
				}catch(Exception e){
					e.printStackTrace();
					// TODO: repeat the request later?
				}
				
			}
		}).start();

	}

	private String getInstallUrl(String params){
		String appid = null;
		if(context!=null){
			appid = context.getApplicationContext().getPackageName();
		}else{
			Clog.e("OPENSDK", "CONTEXT NULL!?!?!?!");
		}
			
		
		StringBuilder urlBuilder = new StringBuilder(Settings.getSettings().INSTALL_BASE_URL);
		urlBuilder.append(params);
		urlBuilder.append(appid!=null?"&appid="+Uri.encode(appid):"");
		
		return urlBuilder.toString();
	}

}

package com.appnexus.opensdk;

import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

import com.appnexus.opensdk.utils.Clog;
import com.appnexus.opensdk.utils.HashingFunctions;
import com.appnexus.opensdk.utils.Settings;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings.Secure;

public class InstallTrackerPixel extends BroadcastReceiver{
	BroadcastReceiver receiver_install;
	Context context;
	
	
	//Test with am broadcast -a com.android.vending.INSTALL_REFERRER --es "referrer" "utm_source=test_source&utm_medium=test_medium&utm_term=test_term&utm_content=test_content&utm_campaign=test_name"
	//in adb
	public InstallTrackerPixel(){
		super();
	}

	@Override
	public void onReceive(Context context, final Intent intent) {
		this.context=context;
		Clog.error_context=context;
		final Bundle extras = intent.getExtras();
		
		new Thread(new Runnable(){

			@Override
			public void run() {
				String referralString = extras.getString("referrer");

				String url = getInstallUrl(referralString);
				
				
				Clog.d(Clog.baseLogTag, Clog.getString(R.string.conversion_pixel, url));
				
				try{
					HttpClient client = new DefaultHttpClient();
					HttpGet get = new HttpGet(url);
					client.execute(get);
					// TODO: what happens if it fails? what is the server response if it succeeds?
				}catch(Exception e){
					e.printStackTrace();
					// TODO: repeat the request later?
				}
				
			}
		}).start();

	}

	private String getInstallUrl(String params){
		String appid = null;
		String hidmd5 = null;
		String hidsha1 = null;
		if(context!=null){
			appid = context.getApplicationContext().getPackageName();
			String aid = android.provider.Settings.Secure.getString(
					context.getContentResolver(), Secure.ANDROID_ID);
			// Get hidmd5, hidsha1, the devide ID hashed
			hidmd5 = HashingFunctions.md5(aid);
			hidsha1 = HashingFunctions.sha1(aid);
		}
		
		StringBuilder urlBuilder = new StringBuilder(Settings.getSettings().INSTALL_BASE_URL);
		urlBuilder.append(params);
		urlBuilder.append(appid!=null?"&appid="+Uri.encode(appid):"");
		urlBuilder.append(hidmd5!=null?"&md5udid="+Uri.encode(hidmd5):"");
		urlBuilder.append(hidsha1!=null?"&sha1udid="+Uri.encode(hidmd5):"");
		
		return urlBuilder.toString();
	}

}

Add device ids to /install call