riccardo91 / android-market-api-net

Automatically exported from code.google.com/p/android-market-api-net
0 stars 0 forks source link

GetAppScreenshot problem. can anyone get it successfully? #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
for (int i = 0; i < app.Extendedinfo.ScreenshotsCount; i++)
            {
                GetImageRequest request = new GetImageRequest
                {
                    AppId = app.Id,
                    ImageId = i.ToString(),
                    ImageUsage = GetImageRequest.AppImageUsage.Screenshot
                };

                try
                {
                    GetImageResponse imgResponse = session.Get(request);

                    if (null != imgResponse)
                    {
                        using (MemoryStream ms = new MemoryStream(imgResponse.ImageData))
                        {
                            Bitmap img = (Bitmap)Image.FromStream(ms);
                            string format = GetImageFormat(img);
                            string fileName = string.Format("{0}_{1}.{2}", System.Guid.NewGuid().ToString("N"), i.ToString(), format);
                            string filePath = string.Format("{0}{1}", realPathPrefix, fileName);
                            img.Save(filePath);
                        }
                    }
                }
                catch (WebException ex)
                {
                    LogHelper.WriteException(ex.Message, ex);
                }
            }

i can't get Screenshot,error code 400 happens, help!

Original issue reported on code.google.com by edward...@gmail.com on 6 Jan 2011 at 9:35

GoogleCodeExporter commented 9 years ago
and when i change the ImageUsage value to Icon or PromoBadge, it is ok.
but i can never get the Screenshot and ScreenshotThumbnail successfully, it 
always return error code 400. 

Original comment by edward...@gmail.com on 6 Jan 2011 at 9:37

GoogleCodeExporter commented 9 years ago
You shall change the version of RequestContext in the file "MarketSession.java"

Here is the code snippet,
public MarketSession() {
  //context.setVersion(1002);
  context.setVersion(1002012);
  ...
}

I got the idea from google groups, it worked for me. Hope it can help...

Original comment by chfswed...@gmail.com on 13 Jan 2011 at 6:00

GoogleCodeExporter commented 9 years ago
thanks very much
!! it works

Original comment by edward...@gmail.com on 27 Jan 2011 at 8:08

GoogleCodeExporter commented 9 years ago
thanks very much! it works!

Original comment by edward...@gmail.com on 27 Jan 2011 at 8:36

GoogleCodeExporter commented 9 years ago
Where can i get the source? i can't see anything in the "download" section..

Original comment by sagitso...@gmail.com on 5 Dec 2011 at 12:45