
import java.io.FileOutputStream;

import com.gc.android.market.api.MarketSession.Callback;
import com.gc.android.market.api.MarketSession;
import com.gc.android.market.api.model.Market.App;
import com.gc.android.market.api.model.Market.AppsResponse;
import com.gc.android.market.api.model.Market.AppsRequest;
import com.gc.android.market.api.model.Market.CommentsRequest;
import com.gc.android.market.api.model.Market.GetImageRequest;
import com.gc.android.market.api.model.Market.GetImageResponse;
import com.gc.android.market.api.model.Market.ResponseContext;
import com.gc.android.market.api.model.Market.GetImageRequest.AppImageUsage;

class test {

    /**
     * @param args
     */
    public static void main(String[] args) {
        try {
            if(args.length < 3) {
                System.out.println("Parameters :\n" +
                        "email password package");
                return;
            }


            String login = args[0];
            String password = args[1];
            String query = args.length > 2 ? args[2] : "Test";

            MarketSession session = new MarketSession();
            System.out.println("Login...");
            session.login(login,password);
            System.out.println("Login done");

            AppsRequest appsRequest = AppsRequest.newBuilder()
                .setQuery(query)
                .setStartIndex(0).setEntriesCount(10)
                .setWithExtendedInfo(true)
                .build();

            MarketSession.Callback callback = new MarketSession.Callback() {

                @Override
                    public void onResult(ResponseContext contex, Object oresp) {
                        AppsResponse response = (AppsResponse)oresp;
                        if(response.getAppCount() != 1) {
                            System.out.println("Not in market, or multiple results");
                        } else {
                            App app = response.getAppList().get(0);
                            System.out.println("Version Code:" + app.getVersionCode());
                            System.out.println("Version:" + app.getVersion());
                        }
                    }

            };
            session.append(appsRequest, callback);
            session.flush();
        } catch(Exception ex) {
            ex.printStackTrace();
        }
    }

}

@@ -14,24 +14,30 @@
 .io.
-FileOutputStream
+*;%0D%0Aimport java.util.*
 ;%0D%0A%0D
@@ -802,9 +802,9 @@
 h %3C 
-3
+2
 ) %7B%0D
@@ -902,16 +902,8 @@
 word
- package
 %22);%0D
@@ -943,20 +943,16 @@
      %7D%0D%0A
-%0D%0A%0D%0A
         
@@ -1016,24 +1016,26 @@
 = args%5B1%5D;%0D%0A
+%0D%0A
             
@@ -1038,415 +1038,766 @@
     
-String query = args.length %3E 2 ? args%5B2%5D : %22Test%22;%0D%0A%0D%0A            MarketSession session = new MarketSession();%0D%0A            System.out.println(%22Login...%22);%0D%0A            session.login(login,password);%0D%0A            System.out.println(%22Login done%22);%0D%0A%0D%0A            AppsRequest appsRequest = AppsRequest.newBuilder()%0D%0A                .setQuery(query)%0D%0A                .setStartIndex(0).setEntriesCount(10)%0D%0A    
+// Get a list of apps we want to check - i.e. those that%0D%0A            // we have metadata files for...%0D%0A            File dir = new File(%22../metadata%22);%0D%0A            List%3CString%3E apps = new ArrayList%3CString%3E();%0D%0A            String%5B%5D metafiles = dir.list();%0D%0A            for (int i=0; i%3Cmetafiles.length; i++) %7B%0D%0A                String metafile = metafiles%5Bi%5D;%0D%0A                if(metafile.endsWith(%22.txt%22)) %7B%0D%0A                    String pkg = metafile.substring(0,%0D%0A                           metafile.length() - 4);%0D%0A                    apps.add(pkg);%0D%0A                %7D%0D%0A            %7D%0D%0A            System.out.println(%22Apps to check: %22 + apps.size());%0D%0A%0D%0A            MarketSession session = new MarketSession();%0D%0A            System.out.println(%22Login...%22);%0D%0A
     
@@ -1808,59 +1808,83 @@
     
-.
 se
-tWithExtendedInfo(true)%0D%0A                .build(
+ssion.login(login,password);%0D%0A            System.out.println(%22Login done%22
 );%0D%0A
@@ -2437,24 +2437,112 @@
 ut.println(%22
+  Package:%22 + app.getPackageName());%0D%0A                            System.out.println(%22  
 Version Code
@@ -2618,16 +2618,18 @@
 rintln(%22
+  
 Version:
@@ -2702,18 +2702,16 @@
      %7D%0D%0A
-%0D%0A
         
@@ -2718,16 +2718,370 @@
     %7D;%0D%0A
+%0D%0A            for(String pkg : apps) %7B%0D%0A                System.out.println(%22Checking: %22 + pkg);%0D%0A                AppsRequest appsRequest = AppsRequest.newBuilder()%0D%0A                    .setQuery(%22pname:%22 + pkg)%0D%0A                    .setStartIndex(0).setEntriesCount(10)%0D%0A                    .setWithExtendedInfo(true)%0D%0A                    .build();%0D%0A    
         
@@ -3128,32 +3128,36 @@
 );%0D%0A            
+    
 session.flush();
@@ -3154,24 +3154,129 @@
 n.flush();%0D%0A
+%0D%0A                // Pause to avoid rate limit...%0D%0A                Thread.sleep(5000);%0D%0A            %7D%0D%0A%0D%0A
         %7D ca

Check current market version for all apps in our repo - just displays, does not update metadata yet