public static RequestQueue NewRequestQueue(Context context, IHttpStack stack, int maxDiskCacheBytes)
        {
            //��֯�����Ŀ¼
            var cacheDir = Directory.CreateDirectory(context.CacheDir.Path + "/" + DEFAULT_CACHE_DIR);
            String userAgent = "volley/0";
            try
            {
                String packageName = context.PackageName;
                var info = context.PackageManager.GetPackageInfo(packageName, 0);
                userAgent = packageName + "/" + info.VersionCode;
            }
            catch (Android.Content.PM.PackageManager.NameNotFoundException) { }

            if (stack == null)
            {
                stack = new HttpClientStack();
            }

            INetwork network = new BasicNetwork(stack);

            RequestQueue queue;
            if (maxDiskCacheBytes <= -1)
            {
                queue = new RequestQueue(new DiskBasedCache(cacheDir), network);
            }
            else
            {
                queue = new RequestQueue(new DiskBasedCache(cacheDir, maxDiskCacheBytes), network);
            }
            return queue;
        }
Exemple #2
0
 public Request SetRequestQueue(RequestQueue requestQueue)
 {
     this.mRequestQueue = requestQueue;
     return(this);
 }