package com.sometrik.framework;

import com.android.vending.billing.IInAppBillingService;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;

public class PurchaseHelper {
	
	IInAppBillingService mService;
	private static PurchaseHelper instance = null;
	protected PurchaseHelper() { }
	public static PurchaseHelper getInstance() {
		if (instance == null) {
			instance = new PurchaseHelper();
		}
		return instance;
	}

	ServiceConnection mServiceConn = new ServiceConnection() {
		@Override
		public void onServiceDisconnected(ComponentName name) {
			mService = null;
		}

		@Override
		public void onServiceConnected(ComponentName name, IBinder service) {
			mService = IInAppBillingService.Stub.asInterface(service);
		}
	};

	public void disconnect(FrameWork framework) {
		if (mService != null) {
			framework.unbindService(mServiceConn);
		}
	}

	public void createConnection(FrameWork framework) {
		Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
		serviceIntent.setPackage("com.android.vending");
		framework.bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);
	}

}

@@ -24,24 +24,55 @@
 amework;%0D%0A%0D%0A
+import java.util.ArrayList;%0D%0A%0D%0A
 import com.a
@@ -123,38 +123,8 @@
 %0D%0A%0D%0A
-import android.app.Activity;%0D%0A
 impo
@@ -284,23 +284,86 @@
 roid.os.
-IBinder
+Bundle;%0D%0Aimport android.os.IBinder;%0D%0Aimport android.os.RemoteException
 ;%0D%0A%0D%0Apub
@@ -968,24 +968,557 @@
 %09%09%7D%0D%0A%09%7D;%0D%0A%0D%0A
+%09public Bundle getItemList(ArrayList%3CString%3E productIDList, String packageName) %7B%0D%0A%09%09//Create a query with Product IDs%0D%0A%09%09Bundle querySkus = new Bundle();%0D%0A%09%09querySkus.putStringArrayList(%22ITEM_ID_LIST%22, productIDList);%0D%0A%09%09try %7B%0D%0A%09%09%09//Retrieve details with query. 3 is the in-app Billing version.%0D%0A%09%09%09return mService.getSkuDetails(3, packageName, %22inapp%22, querySkus);%0D%0A%09%09%7D catch (RemoteException e) %7B%0D%0A%09%09%09System.out.println(%22Error retrieving product list information%22);%0D%0A%09%09%09//TODO%0D%0A%09%09%09e.printStackTrace();%0D%0A%09%09%7D%0D%0A%09%09return null;%0D%0A%09%7D%0D%0A%0D%0A
 %09public void

Add getItemList